Beispiel #1
0
 public bool BoXL(BoXL boXL)
 {
     try
     {
         db.BoXLs.Add(boXL);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #2
0
        public JsonResult UpdateBoXL(int id, string ten, string malsp, int stt)
        {
            var bonho = new BoXL();

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

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