示例#1
0
 public ActionResult Salary_edit_office(int id, OfficeSalary officeSalary)
 {
     try
     {
         using (DBmodel payrollentities = new DBmodel())
         {
             payrollentities.Entry(officeSalary).State = EntityState.Modified;
             payrollentities.SaveChanges();
         }
         return(RedirectToAction("Salary_details_office"));
     }
     catch
     {
         return(View());
     }
 }
示例#2
0
        public ActionResult Add_office_salary(int id, OfficeSalary officeSalary)
        {
            try
            {
                using (DBmodel payrollentities = new DBmodel())
                {
                    payrollentities.OfficeSalaries.Add(officeSalary);
                    payrollentities.SaveChanges();
                }

                return(RedirectToAction("Salary_details_office"));
            }
            catch
            {
                return(View());
            }
        }
示例#3
0
 public ActionResult Salary_delete_office(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         using (DBmodel payrollentities = new DBmodel())
         {
             OfficeSalary officeSalary = payrollentities.OfficeSalaries.Where(x => x.SalaryId == id).FirstOrDefault();
             payrollentities.OfficeSalaries.Remove(officeSalary);
             payrollentities.SaveChanges();
         }
         return(RedirectToAction("Salary_details_office"));
     }
     catch
     {
         return(View());
     }
 }