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()); } }
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()); } }
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()); } }