Ejemplo n.º 1
0
 public ActionResult CreatePhong(FormCollection collection, TAISAN taisan)
 {
     if (ModelState.IsValid)
     {
         int idPhong = 0;
         int.TryParse(collection["var1"], out idPhong);
         taisan.IDPHONG = idPhong;
         if (cc.CreatePhong(taisan))
         {
             return(RedirectToAction("Index", "TaiSan"));
         }
         else
         {
             ModelState.AddModelError("", "Số lượng chọn lớn hơn số lượng của tài sản");
         }
     }
     ViewBag.var1 = new SelectList(cc.LoadPhong(0), "ID", "TENPHONG");
     return(View(cc.Get(taisan.ID)));
 }