public ActionResult DeleteConfirmed(int id) { thutuc thutuc = db.thutucs.Find(id); db.thutucs.Remove(thutuc); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,name,nguoitao,nguoiduyet")] thutuc thutuc) { if (ModelState.IsValid) { db.Entry(thutuc).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(thutuc)); }
public ActionResult Create([Bind(Include = "id,name,nguoitao,nguoiduyet")] thutuc thutuc) { if (ModelState.IsValid) { db.thutucs.Add(thutuc); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(thutuc)); }
// GET: thutucs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } thutuc thutuc = db.thutucs.Find(id); if (thutuc == null) { return(HttpNotFound()); } return(View(thutuc)); }
public ActionResult CapGiayChungNhan([Bind(Include = "id,name")] thutuc thutuc, HttpPostedFileBase file) { var thongtin = db.loaithutucs.ToList(); List <loaithutuc> listID = new List <loaithutuc>(); for (int i = 0; i < thongtin.Count; i++) { if (thongtin[i].loai != Constants.CAPGIAYCHUNGNHAN) { listID.Add(thongtin[i]); } } foreach (loaithutuc item in listID) { thongtin.Remove(item); } if (ModelState.IsValid) { //thutuc.ngaytao = DateTime.Today; // thutuc.anh = "khongco"; db.thutucs.Add(thutuc); db.SaveChanges(); thutuc = db.thutucs.OrderByDescending(u => u.id).FirstOrDefault(); var chitietthutuc = new chitietthutuc(); for (int i = 0; i < thongtin.Count; i++) { chitietthutuc = new chitietthutuc(); chitietthutuc.noidung = Request.Form["thutucname" + i]; chitietthutuc.value = Request.Form["thutuc" + i]; chitietthutuc.thutuc = thutuc.id; db.chitietthutucs.Add(chitietthutuc); } db.SaveChanges(); return(RedirectToAction("Index")); } // ViewBag.id_user = new SelectList(db.users, "id", "username", thutuc.id_user); return(View(thutuc)); }
public ActionResult CapNhatThongTin([Bind(Include = "id, name")] thutuc thutuc, HttpPostedFileBase file) { var thongtin = db.loaithutucs.ToList(); List <loaithutuc> listID = new List <loaithutuc>(); for (int i = 0; i < thongtin.Count; i++) { if (thongtin[i].loai != Constants.CAPNHATTHONGTIN) { listID.Add(thongtin[i]); } } foreach (loaithutuc item in listID) { thongtin.Remove(item); } if (ModelState.IsValid) { //thutuc.ngaytao = DateTime.Today; // thutuc.anh = "khongco"; db.thutucs.Add(thutuc); db.SaveChanges(); thutuc = db.thutucs.OrderByDescending(u => u.id).FirstOrDefault(); var chitietthutuc = new chitietthutuc(); for (int i = 0; i < thongtin.Count; i++) { chitietthutuc = new chitietthutuc(); chitietthutuc.noidung = Request.Form["thutucname" + i]; chitietthutuc.value = Request.Form["thutuc" + i]; chitietthutuc.thutuc = thutuc.id; db.chitietthutucs.Add(chitietthutuc); } db.SaveChanges(); } return(View(thutuc)); }