public TrnDoDto Save(TrnDoDto Dto, LoginDto Login) { try { var Db = Mapper.Map <TRN_DO>(Dto); if (Db.ID == 0) { int Id = 0; var GetLatestNumber = _docNumberRepo.Get().Where(x => x.TANGGAL.Month == DateTime.Now.Month && x.TANGGAL.Year == DateTime.Now.Year && x.FORM_ID == (int)MenuList.TrnDo).ToList(); if (GetLatestNumber.Count() > 0) { Id = GetLatestNumber.Max(x => x.NO.Value); } Db.NO_DO = (Id + 1).ToString(); DOCUMENT_NUMBER DbDocNumber = new DOCUMENT_NUMBER(); DbDocNumber.NO = Id + 1; DbDocNumber.FORM_ID = (int)MenuList.TrnDo; DbDocNumber.TANGGAL = DateTime.Now; _trnDoRepo.InsertOrUpdate(Db, Mapper.Map <Login>(Login), MenuList.TrnDo); _docNumberRepo.InsertOrUpdate(DbDocNumber, Mapper.Map <Login>(Login), MenuList.TrnDo); } else { _trnDoRepo.InsertOrUpdate(Db, Mapper.Map <Login>(Login), MenuList.TrnDo); } _uow.SaveChanges(); return(Mapper.Map <TrnDoDto>(Db)); } catch (Exception) { throw; } }
public void Save(TrnDoDto model) { try { var db = Mapper.Map <TRN_DO>(model); _trnDoServices.Save(db); } catch (Exception) { throw; } }
public void Save(TrnDoDto model, LoginDto LoginDto) { try { var db = Mapper.Map <TRN_DO>(model); var Login = Mapper.Map <Login>(LoginDto); _trnDoServices.Save(db, Login); } catch (Exception) { throw; } }
public void Save(TrnDoDto model) { try { var db = Mapper.Map <TRN_DO>(model); _trnDoRepo.InsertOrUpdate(db); _uow.SaveChanges(); } catch (Exception) { throw; } }