//lấy hệ điều hành id dựa vào name public String getHeDieuHanhId(string name) { HeDieuHanh rs = db.HeDieuHanhs.SingleOrDefault(n => n.Name == name); if (rs == null) { return(null); } return((rs.Id).ToString()); }
public IActionResult Edit(int?id) { if (id == null) { return(RedirectToAction("Index")); } HeDieuHanh chooseOS = dbContext.HeDieuHanhs.Find(id); return(View(chooseOS)); }
public IActionResult Create(HeDieuHanh newOS) { if (ModelState.IsValid) { dbContext.HeDieuHanhs.Add(newOS); dbContext.SaveChanges(); TempData["notifyMsg"] = "Thêm HỆ ĐIỀU HÀNH mới thành công!!!"; return(RedirectToAction("Index")); } return(View(newOS)); }
public IActionResult ConfirmDelete(int?id) { if (id == null) { return(RedirectToAction("Index")); } HeDieuHanh chooseOS = dbContext.HeDieuHanhs.Find(id); dbContext.HeDieuHanhs.Remove(chooseOS); dbContext.SaveChanges(); TempData["notifyMsg"] = "Xóa HỆ ĐIỀU HÀNH của sản phẩm thành công!!!"; return(RedirectToAction("Index")); }
public bool Hedieuhanh(HeDieuHanh heDieuHanh) { try { db.HeDieuHanhs.Add(heDieuHanh); db.SaveChanges(); return(true); } catch { return(false); } }
public JsonResult UpdateHDH(int id, string ten, string malsp, int stt) { var bonho = new HeDieuHanh(); bonho.ID_HDH = id; bonho.Ten = ten; bonho.STT = stt; bonho.MaLSP = Convert.ToInt32(malsp); var result = new UpdateData().Hedieuhanh(bonho); return(Json(new { status = result })); }
public bool Hedieuhanh(HeDieuHanh heDieuHanh) { try { var data = db.HeDieuHanhs.Find(heDieuHanh.ID_HDH); data.Ten = heDieuHanh.Ten; data.MaLSP = heDieuHanh.MaLSP; data.STT = heDieuHanh.STT; db.SaveChanges(); return(true); } catch { return(false); } }
public ActionResult HedieuHanh(HeDieuHanh heDieuHanh) { if (ModelState.IsValid) { bool check = new DataDao().Hedieuhanh(heDieuHanh); if (check) { SetAlert("thêm thành công", "success"); return(RedirectToAction("HedieuHanh", "Data")); } else { ModelState.AddModelError("", "Thêm không thành công"); } } return(View("HedieuHanh")); }
public IActionResult Edit(int?id, HeDieuHanh newOS) { if (id == null) { return(RedirectToAction("Index")); } HeDieuHanh oldOS = dbContext.HeDieuHanhs.Find(id); if (ModelState.IsValid) { if (oldOS.hdh_ID == newOS.hdh_ID) { oldOS.hdh_Name = newOS.hdh_Name; dbContext.SaveChanges(); TempData["notifyMsg"] = "Cập nhật thông tin HỆ ĐIỀU HÀNH thành công!!!"; return(RedirectToAction("Index")); } } return(View(newOS)); }