public virtual void Delete(TEntity entityToDelete) { if (context.Entry(entityToDelete).State == System.Data.Entity.EntityState.Detached) { _dbSet.Attach(entityToDelete); } _dbSet.Remove(entityToDelete); context.SaveChanges(); }
public ActionResult Create([Bind(Include = "SkillId,SkillName")] Skill skill) { if (ModelState.IsValid) { db.Skills.Add(skill); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(skill)); }
public ActionResult DeleteConfirmed(int id) { EmployeeBank employeeBank = db.EmployeeBanks.Find(id); db.EmployeeBanks.Remove(employeeBank); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { PayrollSalaryMasterSheet payrollSalaryMasterSheet = db.PayrollSalaryMasterSheets.Find(id); db.PayrollSalaryMasterSheets.Remove(payrollSalaryMasterSheet); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { PayrollOvertime payrollOvertime = db.PayrollOvertimes.Find(id); db.PayrollOvertimes.Remove(payrollOvertime); db.SaveChanges(); return(RedirectToAction("Index")); }
public int Save() { try { return(_context.SaveChanges()); } catch (System.Data.Entity.Core.OptimisticConcurrencyException ex) { throw ex; } }
public ActionResult Create(InsuranceCompany InsuranceCompany) { if (ModelState.IsValid) { db.InsuranceCompanies.Add(InsuranceCompany); db.SaveChanges(); Session["Success"] = "Insurance Company Created Succesfully"; return(RedirectToAction("Index")); } return(View("InsuranceCompany/Create")); }
public ActionResult Create([Bind(Include = "CatId,CatTitle")] DocumentCategory documentCategory) { if (ModelState.IsValid) { db.DocumentCategories.Add(documentCategory); db.SaveChanges(); Session["Success"] = "Document Category Created Succesfully"; return(RedirectToAction("Index")); } return(View("DocumentCategory/Create")); }