Esempio n. 1
0
 public void CreateOrEditCapPhat(CapPhatInput capPhatInput)
 {
     if (capPhatInput.Id == 0)
     {
         Create(capPhatInput);
     }
     else
     {
         Update(capPhatInput);
     }
 }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 public void CreateOrEditCapPhat([FromBody] CapPhatInput input)
 {
     capPhatAppservice.CreateOrEditCapPhat(input);
 }