Exemplo n.º 1
0
        public ActionResult Edit(Equipment equipment, int roomIdd, int statusId, int categoryId)
        {
            if (ModelState.IsValid)
            {
                Equipment eq = _equipmentDao.GetById(equipment.Id);
                eq.Code        = equipment.Code;
                eq.Room        = _roomDao.GetById(roomIdd);
                eq.Title       = equipment.Title;
                eq.Status      = _equipmentStatusDao.GetById(statusId);
                eq.Category    = _equipmentCategoryDao.GetById(categoryId);
                eq.Warranty    = equipment.Warranty;
                eq.Purchased   = equipment.Purchased;
                eq.Description = equipment.Description;

                _equipmentDao.Update(eq);

                InitViewBag();
                return(RedirectToAction("Index", "Equipment"));
            }

            Equipment e = _equipmentDao.GetById(equipment.Id);

            InitViewBag();
            return(View("Detail", e));
        }
Exemplo n.º 2
0
 public void Update(Equipment equ)
 {
     for (int i = 0; i < equipmentViewList.Count(); i++)
     {
         if (equipmentViewList[i].Index == equ.Index)
         {
             equipmentDao.Update(equ);
         }
     }
     SelectAllEquipment();
     UpdateViewData();
 }