public int Delete(int ContractorBasicSalaryID, int UserIdentity)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             ContractorsBasicSalaries Obj = db.ContractorsBasicSalaries.SingleOrDefault(x => x.ContractorBasicSalaryID.Equals(ContractorBasicSalaryID));
             db.ContractorsBasicSalaries.Remove(Obj);
             return(db.SaveChanges(UserIdentity));
         }
     }
     catch
     {
         throw;
     }
 }
 public int Update(ContractorsBasicSalaries ContractorBasicSalary)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             ContractorsBasicSalaries Obj = db.ContractorsBasicSalaries.SingleOrDefault(x => x.ContractorBasicSalaryID.Equals(ContractorBasicSalary.ContractorBasicSalaryID));
             Obj.EmployeeCodeID     = ContractorBasicSalary.EmployeeCodeID;
             Obj.BasicSalary        = ContractorBasicSalary.BasicSalary;
             Obj.TransfareAllowance = ContractorBasicSalary.TransfareAllowance;
             Obj.LastUpdatedDate    = ContractorBasicSalary.LastUpdatedDate;
             Obj.LastUpdatedBy      = ContractorBasicSalary.LastUpdatedBy;
             return(db.SaveChanges());
         }
     }
     catch
     {
         throw;
     }
 }
 public int Insert(ContractorsBasicSalaries ContractorBasicSalary)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.ContractorsBasicSalaries.Add(ContractorBasicSalary);
             db.SaveChanges();
             return(ContractorBasicSalary.ContractorBasicSalaryID);
         }
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
             }
         }
         throw;
     }
 }