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 21b6be34..9e58ca97 100644 Binary files a/DOC/核心设计.EAP and b/DOC/核心设计.EAP differ diff --git a/OpenAuth.App/AppManager.cs b/OpenAuth.App/AppManager.cs new file mode 100644 index 00000000..8e272e9d --- /dev/null +++ b/OpenAuth.App/AppManager.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using OpenAuth.App.Request; +using OpenAuth.App.Response; +using OpenAuth.Repository.Domain; + +namespace OpenAuth.App +{ + /// + /// 分类管理 + /// + 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