Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
 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;
     }
 }
Esempio n. 4
0
        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));
        }