public EmpOtherItem GetById(int id) { Mapper.CreateMap <EmployeeOtherDetail, EmpOtherItem>(); EmployeeOtherDetail objOther = DbContext.EmployeeOtherDetails.SingleOrDefault(m => m.OtherId == id); EmpOtherItem objOtherItem = Mapper.Map <EmpOtherItem>(objOther); return(objOtherItem); }
public int Update(EmpOtherItem model) { Mapper.CreateMap <EmpOtherItem, EmployeeOtherDetail>(); EmployeeOtherDetail objOther = DbContext.EmployeeOtherDetails.SingleOrDefault(m => m.OtherId == model.OtherId); objOther = Mapper.Map(model, objOther); return(DbContext.SaveChanges()); }
public int Insert(EmpOtherItem model) { try { Mapper.CreateMap <EmpOtherItem, EmployeeOtherDetail>(); EmployeeOtherDetail objEmpOther = Mapper.Map <EmployeeOtherDetail>(model); DbContext.EmployeeOtherDetails.Add(objEmpOther); return(DbContext.SaveChanges()); } catch (Exception ex) { throw ex; } }