Commit 97e7473f authored by Jason's avatar Jason

編輯鑰匙 尚未完成

parent 3e26ff35
......@@ -306,5 +306,81 @@ namespace backstage.Controllers
}
/// <summary>
/// ajax 編輯鑰匙
/// </summary>
/// <returns></returns>
[Authorize(Policy = "AdminOnly")]
[HttpPost]
public async Task<ResultModel> EditKey(int keyId,string name, int active)
{
var result = new ResultModel();
string msg;
#region key/list
var url = _config["IP"] + "/security/key";
var httpMethod = HttpMethod.Put;
var parameters = new Dictionary<string, string>
{
{ "id",keyId.ToString()},
{ "name",name},
{ "active",active.ToString()},
};
var apiResult = await _callApi.CallAPI(url, parameters, httpMethod);
if (apiResult.IsSuccess)
{
try
{
var Response = JsonConvert.DeserializeObject<Response>(apiResult.Data.ToString());
if (Response.r == 0)
{
switch (_currentLanguage)
{
case "en":
msg = "Edit key success.";
break;
case "zh":
msg = "編輯鑰匙成功";
break;
default:
msg = "編輯鑰匙成功";
break;
}
result.IsSuccess = true;
result.Message = msg;
return result;
}
else
{
result.IsSuccess = false;
result.Message = Response.m.ToString();
return result;
}
}
catch (Exception e)
{
result.IsSuccess = false;
result.Message = e.Message + e.InnerException?.Message;
return result;
}
}
result.IsSuccess = false;
result.Message = apiResult.Message;
return result;
#endregion
}
}
}
\ No newline at end of file
......@@ -204,6 +204,93 @@
</div><!-- END of div "modal-dialog modal-lg" -->
</div><!-- END of Modal-->
<!--END of New App Popup Form-->
<!--END of 權限 Popup Form-->
<!--New App Popup Form-->
<!-- Modal -->
<div class="modal fade" id="editApp" role="dialog" tabindex="-1">
<div class="modal-dialog modalforMemberGo">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<!--
<button type="button" class="close" data-dismiss="modal">&times;</button>
-->
<h3 class="modal-title">
<img src="~/images/memberGo/apiKey/newapp-orange-300ppi.png">
@Localizer["Edit key"]
</h3>
</div> <!--END of div "modal-header"-->
<div class="modal-body" style="padding-top:35px">
<form class="form-horizontal0">
<div class="form-group">
<label class="control-label" for="projectid">@Localizer["Name"]:</label>
<div>
<input type="text" class="form-control input-sm" id="key_name">
</div>
</div>
<div class="form-group">
<label class="control-label" for="projectid">@Localizer["active"]:</label>
<div>
<input type="text" class="form-control input-sm" id="key_name">
</div>
</div>
<!--<div class="form-group">
<label class="control-label" for="projectType">類型:</label>
<div>
<select id="projectType" class="form-control" onchange="showAppAdv()">
<option value=0>請選擇類型</option>
<option value=1>Android</option>
<option value=2>iOS</option>
</select>
</div>
</div>-->
<!--End of 類型:-->
<!-- Andorid Adv-->
<!--<div id="andoridAdvID" class="andoridAdv">
<div class="form-group">
<label class="control-label" for="packageName">套件名稱:</label>
<div>
<input type="text" class="form-control input-sm" id="packageName" placeholder="例如 com.example">
</div>
</div>
<div class="form-group">
<label class="control-label" for="packageName">SHA-1指紋憑證:</label>
<div>
<input type="text" class="form-control input-sm" id="fingerPrint" placeholder="例如: AA:BB:CC:DD:EE:00:11:22:33:44:FF:GG:HH:II:JJ:55:66:77:88:99">
</div>
</div>-->
<!--End of app id:-->
<!--</div>--> <!-- End of Andorid Adv-->
<!-- iOS Adv-->
<!--<div id="iOSAdvID" class="iOSAdv">
<div class="form-group">
<label class="control-label" for="bundleID">繫結識別碼:</label>
<div>
<input type="text" class="form-control input-sm" id="bundleID" placeholder="例如 com.example.MyApp">
</div>
</div>-->
<!--End of app id:-->
<!-- <div class="description col-sm-12 text-center">
當您新增一個App後,系統會自動產生一組API金鑰,可至App列表中檢視
</div> -->
<!--</div>--> <!-- End of iOS Adv-->
<div class="SubmitBlock">
<button id="CreateKey" type="button" class="btn btn-mainblue-solid btnSubmit">新增</button>
<button type="button" class="btn btn-mainblue-hollow btnReset" data-dismiss="modal">取消</button>
</div>
</form>
</div> <!--END of div "modal-body"-->
<div class="modal-footer modalforMemberGo">
<!--
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-->
</div> <!--END of div "modal-footer"-->
</div><!-- END of Modal content-->
</div><!-- END of div "modal-dialog modal-lg" -->
</div><!-- END of Modal-->
<!--END of New App Popup Form-->
@section Scripts{
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment