public EmpDepositeItem GetById(int id) { Mapper.CreateMap <EmployeeDeposite, EmpDepositeItem>(); EmployeeDeposite objDep = DBContext.EmployeeDeposites.SingleOrDefault(m => m.DepId == id); EmpDepositeItem objDepItem = Mapper.Map <EmpDepositeItem>(objDep); return(objDepItem); }
public int Update(EmpDepositeItem model) { Mapper.CreateMap <EmpDepositeItem, EmployeeDeposite>(); EmployeeDeposite objDep = DBContext.EmployeeDeposites.SingleOrDefault(m => m.DepId == model.DepId); objDep = Mapper.Map(model, objDep); return(DBContext.SaveChanges()); }
public int Insert(EmpDepositeItem model) { try { Mapper.CreateMap <EmpDepositeItem, EmployeeDeposite>(); EmployeeDeposite objempDeposite = Mapper.Map <EmployeeDeposite>(model); DBContext.EmployeeDeposites.Add(objempDeposite); return(DBContext.SaveChanges()); } catch (Exception ex) { throw ex; } }