public ActionResult Update_LF(FormCollection form) { if (!AuthCheck("admin")) { return(RedirectToAction("Index", "QLHome")); } string id = form["idLF_edit"].ToString(); loai_do_an lf = db.loai_do_an.Where(item => item.id == id).FirstOrDefault(); lf.ten = form["tenLF_edit"]; db.SaveChanges(); return(Redirect(Url.Action("Index", "QLSetting") + "#LF")); }
public ActionResult Delete_LF(FormCollection form) { if (!AuthCheck("admin")) { return(RedirectToAction("Index", "QLHome")); } try { string id = form["idLF_delete"].ToString(); loai_do_an lf = db.loai_do_an.Where(item => item.id == id).FirstOrDefault(); db.Entry(lf).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); return(Redirect(Url.Action("Index", "QLSetting") + "#LF")); } catch (Exception e) { ViewBag.Error = e.ToString(); return(View("~/Views/QLHome/Error.cshtml")); } }
public ActionResult Add_LF(FormCollection form) { if (!AuthCheck("admin")) { return(RedirectToAction("Index", "QLHome")); } try { loai_do_an lf = new loai_do_an(); lf.id = form["idLF"]; lf.ten = form["tenLF"]; db.loai_do_an.Add(lf); db.SaveChanges(); return(Redirect(Url.Action("Index", "QLSetting") + "#LF")); } catch (Exception e) { ViewBag.Error = e.ToString(); return(View("~/Views/QLHome/Error.cshtml")); } }