From 6c05096138b0b79dbaa1ef6c2720babda92452b0 Mon Sep 17 00:00:00 2001 From: "yubaolee@163.com" Date: Fri, 13 Apr 2018 17:25:49 +0800 Subject: [PATCH] check bugs --- .gitignore | 9 +++ DOC/核心设计.EAP | Bin 1249280 -> 1249280 bytes OpenAuth.App/AppManager.cs | 38 +++++++++ OpenAuth.App/Request/QueryAppListReq.cs | 7 ++ .../Controllers/ApplicationsController.cs | 72 ++++++++++++++++++ 5 files changed, 126 insertions(+) create mode 100644 OpenAuth.App/AppManager.cs create mode 100644 OpenAuth.App/Request/QueryAppListReq.cs create mode 100644 OpenAuth.Mvc/Controllers/ApplicationsController.cs diff --git a/.gitignore b/.gitignore index bcc77352..e1026774 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,12 @@ /OpenAuth.sln.GhostDoc.xml /类结构.mdj /数据库设计关系图/OpenAuthDB.pdb +/OpenAuth.WebTest/obj/Release +/OpenAuth.UnitTest/obj/Release +/OpenAuth.WebApi/obj/Release +/OpenAuth.Repository/bin/Release +/OpenAuth.Repository/obj/Release +/OpenAuth.Mvc/obj/Release +/OpenAuth.App/obj/Release +/Infrastructure/bin/Release +/Infrastructure/obj/Release diff --git a/DOC/核心设计.EAP b/DOC/核心设计.EAP index 21b6be349667af148864c5d85a4cd9cbc18177c8..9e58ca97dc7ce4ad2ae7e9e39a44348e80e399b8 100644 GIT binary patch delta 205 zcmZoz;M1_cX9E)(lPvReMGK+u=>`@;9=HhGCXO}^#x@S7HV)=C4wg0!)@>YYOc4Uo zOg>?bJ}eAvY;DKdj_ERO7fN80X4<|fkxiI!`=2B>H|FhaX>2u&V!rIB7#JAX8D6m8 zVZU>H1A7g7&GA(B?Sc)=zUmMGK+u=>`@;9=HhGCXO}^#x@S7HV)=C4wg0!)@>YYOc4T$ z7=6MVeV7^A*xHV5Vq{?0E|kC~%`|;Q659+j-~5!+oXq4zr~H&kTfN+TYhM?4r-0zh zT-S=! + /// 分类管理 + /// + public class AppManager : BaseApp + { + public void Add(Application Application) + { + if (string.IsNullOrEmpty(Application.Id)) + { + Application.Id = Guid.NewGuid().ToString(); + } + Repository.Add(Application); + } + + public void Update(Application Application) + { + Repository.Update(u =>u.Id,Application); + } + + + public List GetList(QueryAppListReq request) + { + var applications = UnitWork.Find(null) ; + + return applications.ToList(); + } + + } +} \ No newline at end of file diff --git a/OpenAuth.App/Request/QueryAppListReq.cs b/OpenAuth.App/Request/QueryAppListReq.cs new file mode 100644 index 00000000..20081a07 --- /dev/null +++ b/OpenAuth.App/Request/QueryAppListReq.cs @@ -0,0 +1,7 @@ +namespace OpenAuth.App.Request +{ + public class QueryAppListReq : PageReq + { + + } +} diff --git a/OpenAuth.Mvc/Controllers/ApplicationsController.cs b/OpenAuth.Mvc/Controllers/ApplicationsController.cs new file mode 100644 index 00000000..a3722694 --- /dev/null +++ b/OpenAuth.Mvc/Controllers/ApplicationsController.cs @@ -0,0 +1,72 @@ +using System; +using System.Web.Http; +using System.Web.Mvc; +using Infrastructure; +using OpenAuth.App; +using OpenAuth.App.Request; +using OpenAuth.App.Response; +using OpenAuth.Repository.Domain; + +namespace OpenAuth.Mvc.Controllers +{ + public class ApplicationsController : BaseController + { + public AppManager App { get; set; } + + + public string GetList([FromUri]QueryAppListReq request) + { + return JsonHelper.Instance.Serialize(App.GetList(request)); + } + + [System.Web.Mvc.HttpPost] + public string Delete(string[] ids) + { + Response resp = new Response(); + try + { + App.Delete(ids); + } + catch (Exception e) + { + resp.Code = 500; + resp.Message = e.Message; + } + return JsonHelper.Instance.Serialize(resp); + } + + [System.Web.Mvc.HttpPost] + public string Add(Application obj) + { + Response resp = new Response(); + try + { + App.Add(obj); + } + catch (Exception e) + { + resp.Code = 500; + resp.Message = e.Message; + } + return JsonHelper.Instance.Serialize(resp); + } + + [System.Web.Mvc.HttpPost] + public string Update(Application obj) + { + Response resp = new Response(); + try + { + App.Update(obj); + } + catch (Exception e) + { + resp.Code = 500; + resp.Message = e.Message; + } + return JsonHelper.Instance.Serialize(resp); + } + + + } +} \ No newline at end of file