diff --git a/Infrastructure/Infrastructure.csproj b/Infrastructure/Infrastructure.csproj index 1ff7ab97..197466e9 100644 --- a/Infrastructure/Infrastructure.csproj +++ b/Infrastructure/Infrastructure.csproj @@ -62,6 +62,7 @@ + diff --git a/Infrastructure/Response.cs b/Infrastructure/Response.cs new file mode 100644 index 00000000..279d4139 --- /dev/null +++ b/Infrastructure/Response.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Infrastructure +{ + public class Response + { + public bool Status = true; + public string Message = "操作成功"; + public dynamic Result; + } +} diff --git a/OpenAuth.Mvc/Controllers/OrgManagerController.cs b/OpenAuth.Mvc/Controllers/OrgManagerController.cs index ceabfa21..e509389b 100644 --- a/OpenAuth.Mvc/Controllers/OrgManagerController.cs +++ b/OpenAuth.Mvc/Controllers/OrgManagerController.cs @@ -12,6 +12,7 @@ namespace OpenAuth.Mvc.Controllers public class OrgManagerController : BaseController { private OrgManagerApp _orgApp; + private Response _response = new Response(); public OrgManagerController() { @@ -35,14 +36,24 @@ namespace OpenAuth.Mvc.Controllers return JsonHelper.Instance.Serialize(_orgApp.LoadAllChildren(id)); } - public void DelOrg(string json) + public string DelOrg(string json) { - var delObj = JsonHelper.Instance.Deserialize(json); - foreach (var obj in delObj) + try { - _orgApp.DelOrg(obj.Id); + var delObj = JsonHelper.Instance.Deserialize(json); + foreach (var obj in delObj) + { + _orgApp.DelOrg(obj.Id); + } } - + catch (Exception e) + { + _response.Status = false; + _response.Message = e.Message; + } + + return JsonHelper.Instance.Serialize(_response); + } } } \ No newline at end of file diff --git a/OpenAuth.Mvc/Views/OrgManager/Index.cshtml b/OpenAuth.Mvc/Views/OrgManager/Index.cshtml index 2d070765..ae53ce81 100644 --- a/OpenAuth.Mvc/Views/OrgManager/Index.cshtml +++ b/OpenAuth.Mvc/Views/OrgManager/Index.cshtml @@ -3,6 +3,8 @@
    + +
    @@ -10,70 +12,109 @@ \ No newline at end of file