示例#1
0
 public bool Add(EmpModel model)
 {
     try
     {
         Employee emp = new Employee
         {
             address   = model.address,
             age       = model.age,
             birthdate = model.birthdate,
             email     = model.email,
             fName     = model.fName,
             gender    = model.gender,
             hobby     = model.hobby,
             lName     = model.lName,
             mName     = model.mName
         };
         _db.Employees.Add(emp);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception exp)
     {
     }
     return(false);
 }
示例#2
0
 public bool Add(SalaryModel model)
 {
     try
     {
         Salary salary = new Salary
         {
             date  = model.date,
             empId = model.empId,
             sal   = model.sal,
         };
         _db.Salaries.Add(salary);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception exp)
     {
     }
     return(false);
 }