public bool Hopso(HopSo hopSo) { try { db.HopSoes.Add(hopSo); db.SaveChanges(); return(true); } catch { return(false); } }
public JsonResult UpdateHopSo(int id, string ten, string malsp, int stt) { var bonho = new HopSo(); bonho.ID_HS = id; bonho.Ten = ten; bonho.STT = stt; bonho.MaLSP = Convert.ToInt32(malsp); var result = new UpdateData().Hopso(bonho); return(Json(new { status = result })); }
public bool Hopso(HopSo hopSo) { try { var data = db.Rams.Find(hopSo.ID_HS); data.Ten = hopSo.Ten; data.MaLSP = hopSo.MaLSP; data.STT = hopSo.STT; db.SaveChanges(); return(true); } catch { return(false); } }
public ActionResult HopSo(HopSo hopSo) { if (ModelState.IsValid) { bool check = new DataDao().Hopso(hopSo); if (check) { SetAlert("thêm thành công", "success"); return(RedirectToAction("HopSo", "Data")); } else { ModelState.AddModelError("", "Thêm không thành công"); } } return(View("HopSo")); }