public void CreateOrEditCapPhat(CapPhatInput capPhatInput) { if (capPhatInput.Id == 0) { Create(capPhatInput); } else { Update(capPhatInput); } }
private void Update(CapPhatInput CapPhatInput) { var capPhatEnity = capPhatrepository.GetAll().Where(x => !x.IsDelete).SingleOrDefault(x => x.Id == CapPhatInput.Id); if (capPhatEnity == null) { } ObjectMapper.Map(CapPhatInput, capPhatEnity); SetAuditEdit(capPhatEnity); capPhatrepository.Update(capPhatEnity); CurrentUnitOfWork.SaveChanges(); }
private void Create(CapPhatInput CapPhatInput) { var taiSanEnity = taisanrepository.GetAll().Where(x => !x.IsDelete).SingleOrDefault(x => x.Id == CapPhatInput.MaTaiSan); if (CapPhatInput.SoLuong > taiSanEnity.SoLuong) { return; } var capPhatEnity = ObjectMapper.Map <CapPhat>(CapPhatInput); SetAuditInsert(capPhatEnity); capPhatrepository.Insert(capPhatEnity); taiSanEnity.SoLuong -= CapPhatInput.SoLuong; CurrentUnitOfWork.SaveChanges(); }
public void CreateOrEditCapPhat([FromBody] CapPhatInput input) { capPhatAppservice.CreateOrEditCapPhat(input); }