/// <summary> /// Add entity. /// </summary> /// <param name="arg"></param> /// <returns></returns> public Response <Guid> Add(PST.Domain.FFP arg) { P.CheckArgNotNull(arg, "arg", "arg cannnot be null."); using (var context = new Entities()) using (IUnitOfWork uow = new UnitOfWork(context)) { var entity = AutoMapperBootstrap.M.Map <PST.Data.FFP>(arg); AddAssignment(arg, entity); uow.FFPRepository.Add(entity); uow.Commit(); return(Response <Guid> .Succeed(entity.Id)); } }
/// <summary> /// Update entity. /// </summary> /// <param name="arg"></param> /// <returns></returns> public Response Update(PST.Domain.FFP arg) { P.CheckArgNotNull(arg, "arg", "arg cannnot be null."); using (var context = new Entities()) using (IUnitOfWork uow = new UnitOfWork(context)){ var exist = uow.FFPRepository.GetById(arg.Id); if (exist == null) { return(Response.Failed("您要更新的数据不存在。")); } AutoMapperBootstrap.M.Map(arg, exist); UpdateAssignment(arg, exist); uow.Commit(); return(Response.Succeed()); } }
private void UpdateAssignment(FFP src, Data.FFP dest) { }
private void AddAssignment(FFP src, Data.FFP dest) { }