Example #1
0
 public long Insert(Employee item)
 {
     try
     {
         db.Employees.Add(item);
         db.SaveChanges();
         return(item.ID);
     }
     catch
     {
         return(0);
     }
 }
 public bool Insert(ProductCategory item)
 {
     try
     {
         db.ProductCategories.Add(item);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #3
0
 public bool Insert(Salary item)
 {
     try
     {
         Salary check = db.Salaries.Where(x => x.EmpID == item.EmpID).SingleOrDefault();
         if (check == null)
         {
             db.Salaries.Add(item);
             db.SaveChanges();
             return(true);
         }
         else
         {
             MessageBox.Show("mã nhân viên trong bảng Salary đã bị trùng");
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }