public bool Run(AomObjectViewModel model, IUnitOfWork unitOfWork, Response <AomObjectViewModel> result) { var dbModel = unitOfWork.With <AomObject>().Find(model.Id); var updatedDbModel = AomObjectMapper.MapInsertModelToDbModel(model, dbModel); unitOfWork.With <AomObject>().AddOrUpdate(updatedDbModel); unitOfWork.SaveChanges(); var newCustomResult = AomObjectMapper.MapDbModelToViewModel(updatedDbModel); result.Data = newCustomResult; return(true); }
public bool Run(AomObjectViewModel model, IUnitOfWork unitOfWork, Response <AomObjectViewModel> result) { var newCustom = AomObjectMapper.MapInsertModelToDbModel(model); unitOfWork.With <AomObject>().Add(newCustom); unitOfWork.SaveChanges(); CreatedId = newCustom.Id; var newCustomResult = AomObjectMapper.MapDbModelToViewModel(newCustom); result.Data = newCustomResult; return(true); }