public ActionResult xoa_HT1(int?id) { HOTRO hotro = db.HOTROes.SingleOrDefault(s => s.MA_HT == id); db.HOTROes.Remove(hotro); db.SaveChanges(); return(RedirectToAction("ListHT")); }
public ActionResult them_HT(HOTRO ht, FormCollection form) { if (!ModelState.IsValid) { return(View(ht)); } db.HOTROes.Add(ht); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditTTHT(string id) { try { int idInt = Convert.ToInt32(id); HOTRO hotro = db.HOTROes.SingleOrDefault(ht => ht.MA_HT == idInt); if (hotro.MA_TT_HT == "01") { hotro.MA_TT_HT = "02"; } else { hotro.MA_TT_HT = "01"; } db.SaveChanges(); return(Json(true, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(null); } }