check bugs

This commit is contained in:
yubaolee@163.com 2018-04-13 17:25:49 +08:00
parent 9e7e8f82ae
commit 6c05096138
5 changed files with 126 additions and 0 deletions

9
.gitignore vendored
View File

@ -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

Binary file not shown.

View File

@ -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
{
/// <summary>
/// 分类管理
/// </summary>
public class AppManager : BaseApp<Application>
{
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<Application> GetList(QueryAppListReq request)
{
var applications = UnitWork.Find<Application>(null) ;
return applications.ToList();
}
}
}

View File

@ -0,0 +1,7 @@
namespace OpenAuth.App.Request
{
public class QueryAppListReq : PageReq
{
}
}

View File

@ -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);
}
}
}