예제 #1
0
 public bool BoNho(BoNho boNho)
 {
     try
     {
         db.BoNhoes.Add(boNho);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #2
0
        public JsonResult UpdateBoNho(int id, string ten, string malsp, int stt)
        {
            var bonho = new BoNho();

            bonho.ID_BN = id;
            bonho.Ten   = ten;
            bonho.STT   = stt;
            bonho.MaLSP = Convert.ToInt32(malsp);
            var result = new UpdateData().BoNho(bonho);

            return(Json(new
            {
                status = result
            }));
        }
예제 #3
0
 public bool BoNho(BoNho boNho)
 {
     try
     {
         var data = db.BoNhoes.Find(boNho.ID_BN);
         data.Ten   = boNho.Ten;
         data.MaLSP = boNho.MaLSP;
         data.STT   = boNho.STT;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #4
0
 public ActionResult BoNho(BoNho boNho)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().BoNho(boNho);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("BoNho", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("BoNho"));
 }