コード例 #1
0
        public IActionResult EditType(EditTypeView model)
        {
            var type = _inventoryService.GetTypeById(model.Type.InventoryTypeId);

            if (type == null)
            {
                return(RedirectToAction("ManageTypes"));
            }

            type.Type           = model.Type.Type;
            type.Description    = model.Type.Description;
            type.ExpiresDays    = model.Type.ExpiresDays;
            type.UnitOfMesasure = model.Type.UnitOfMesasure;

            _inventoryService.SaveType(type);

            return(RedirectToAction("ManageTypes"));
        }
コード例 #2
0
        public IActionResult EditType(int typeId)
        {
            var type = _inventoryService.GetTypeById(typeId);

            if (type == null)
            {
                return(RedirectToAction("ManageTypes"));
            }

            if (type.DepartmentId != DepartmentId)
            {
                Unauthorized();
            }

            var model = new EditTypeView();

            model.Type = type;

            return(View(model));
        }