public EmpVisaItem GetById(int id) { Mapper.CreateMap <EmployeeVisa, EmpVisaItem>(); EmployeeVisa objVisa = DbContext.EmployeeVisas.SingleOrDefault(m => m.VId == id); EmpVisaItem objVisaItem = Mapper.Map <EmpVisaItem>(objVisa); return(objVisaItem); }
public int Update(EmpVisaItem model) { Mapper.CreateMap <EmpVisaItem, EmployeeVisa>(); EmployeeVisa objVisa = DbContext.EmployeeVisas.SingleOrDefault(m => m.VId == model.VId); objVisa = Mapper.Map(model, objVisa); return(DbContext.SaveChanges()); }
public int Insert(EmpVisaItem model) { try { Mapper.CreateMap <EmpVisaItem, EmployeeVisa>(); EmployeeVisa objVisa = Mapper.Map <EmployeeVisa>(model); DbContext.EmployeeVisas.Add(objVisa); return(DbContext.SaveChanges()); } catch (Exception ex) { throw; } }
public VisaDocumentRequestDTO newVisaDocumentRequest(VisaDocumentRequestDTO VisaDocumentRequest) { var addedVisaDocumentRequest = MapperFactory.CurrentMapper.Map <VisaDocumentRequests>(VisaDocumentRequest); uow.GetRepository <VisaDocumentRequests>().Add(addedVisaDocumentRequest); uow.SaveChanges(); var addedEmployeeVisaDocumentRequest = new EmployeeVisa() { EmployeeId = VisaDocumentRequest.EmployeeId, VisaDocumentRequestsId = addedVisaDocumentRequest.Id }; uow.GetRepository <EmployeeVisa>().Add(addedEmployeeVisaDocumentRequest); uow.SaveChanges(); return(MapperFactory.CurrentMapper.Map <VisaDocumentRequestDTO>(addedVisaDocumentRequest)); }