예제 #1
0
 public ActionResult ChiTietSuaMon(Mon mon)
 {
     repository.UpdateMon(mon);
     repository.Save();
     ViewBag.Mess = "Sửa thành công";
     return View();
 }
예제 #2
0
 public void AddMon(Mon mon)
 {
     db.Mons.Add(mon);
 }
예제 #3
0
 public void UpdateMon(Mon mon)
 {
     db.Entry(mon).State = System.Data.EntityState.Modified;
 }
예제 #4
0
 public void DeleteMon(Mon mon)
 {
     var m = db.Mons.Find(mon.Id);
     db.Mons.Remove(m);
 }
예제 #5
0
 public ActionResult ThemMon(Mon mon)
 {
     if (ModelState.IsValid)
     {
         repository.AddMon(mon);
         repository.Save();
         ViewBag.Mess = "Đã thêm thành công";
         return View();
     }
     ViewBag.Mess = "Dữ liệu nhập không chính xác, vui lòng nhập lại";
     return View();
 }
예제 #6
0
 public ActionResult DeleteMon(Mon mon)
 {
     repository.DeleteMon(mon);
     repository.Save();
     return RedirectToAction("SuaMon", "Admin");
 }