示例#1
0
        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);
        }
示例#2
0
        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());
        }
示例#3
0
 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;
     }
 }