public ActionResult DeleteConfirmed(int id) { BangTheoDoiToCat bangTheoDoiToCat = db.BangTheoDoiToCats.Find(id); db.BangTheoDoiToCats.Remove(bangTheoDoiToCat); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Update(BangTheoDoiToCat bangTheoDoiToCat) { if (ModelState.IsValid) { _context.Entry(bangTheoDoiToCat).State = EntityState.Modified; _context.SaveChanges(); } return(Json(bangTheoDoiToCat, JsonRequestBehavior.AllowGet)); }
public ActionResult Create([Bind(Exclude = "MaChuyen")] BangTheoDoiToCat bangTheoDoiToCat) { if (ModelState.IsValid) { _context.BangTheoDoiToCats.Add(bangTheoDoiToCat); _context.SaveChanges(); } return(Json(bangTheoDoiToCat, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit([Bind(Include = "MaChuyen,MaHang,SLKeHoach,ThucHien,LuyKeThucHien,DenBaoCapBTP")] BangTheoDoiToCat bangTheoDoiToCat) { if (ModelState.IsValid) { db.Entry(bangTheoDoiToCat).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaHang = new SelectList(db.BangTenMatHangs, "MaHang", "TenHang", bangTheoDoiToCat.MaHang); return(View(bangTheoDoiToCat)); }
// GET: BangTheoDoiToCats/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BangTheoDoiToCat bangTheoDoiToCat = db.BangTheoDoiToCats.Find(id); if (bangTheoDoiToCat == null) { return(HttpNotFound()); } return(View(bangTheoDoiToCat)); }
// GET: BangTheoDoiToCats/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BangTheoDoiToCat bangTheoDoiToCat = db.BangTheoDoiToCats.Find(id); if (bangTheoDoiToCat == null) { return(HttpNotFound()); } ViewBag.MaHang = new SelectList(db.BangTenMatHangs, "MaHang", "TenHang", bangTheoDoiToCat.MaHang); return(View(bangTheoDoiToCat)); }
public JsonResult Update(string model) { JavaScriptSerializer serializer = new JavaScriptSerializer(); BangTheoDoiToCat bangtheodoi = serializer.Deserialize <BangTheoDoiToCat>(model); //save db... var entity = _context.BangTheoDoiToCats.Single(x => x.MaChuyen == bangtheodoi.MaChuyen); if (model.Contains("LuyKeThucHien")) { entity.LuyKeThucHien = bangtheodoi.LuyKeThucHien; } else if (model.Contains("SLKeHoach")) { entity.SLKeHoach = bangtheodoi.SLKeHoach; } else if (model.Contains("ThucHien")) { entity.ThucHien = bangtheodoi.ThucHien; } _context.SaveChanges(); return(Json(new { status = true }, JsonRequestBehavior.AllowGet)); }