Пример #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));
        }
        public ActionResult Detail(int id)
        {
            EquipmentStatus equipmentStatus = _equipmentStatusDao.GetById(id);

            return(View(equipmentStatus));
        }