|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
using AMSDto;
|
|
|
|
|
using Common;
|
|
|
|
|
using djy.Model.Ams;
|
|
|
|
|
using djy.Service;
|
|
|
|
|
using djy.Service.Ams;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Shared.Repository;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace djy_AmsApi.Controllers
|
|
|
|
@ -11,25 +13,41 @@ namespace djy_AmsApi.Controllers
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
public class AmsController : ApiBase
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DapperDBBase dapper = new DapperDBBase();
|
|
|
|
|
AmsService ser =new AmsService();
|
|
|
|
|
|
|
|
|
|
[HttpPost("Add")]
|
|
|
|
|
public Response Add(AMSSaveDto Dto)
|
|
|
|
|
{
|
|
|
|
|
var result = new Response();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
AMS_Master master = Dto.MapTo<AMS_Master>();
|
|
|
|
|
using (var transaction = dapper.BeginTransaction(dapper.GetConn()))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ser.SaveInfo(Dto);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
master.CreateTime = DateTime.Now;
|
|
|
|
|
var gid = dapper.InsertByEntityAsync(master);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
transaction.Rollback();
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|