Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("SwitchGearTypeId,SwitchGearTypeName")] LookUpSwitchGearType lookUpSwitchGearType)
        {
            if (id != lookUpSwitchGearType.SwitchGearTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lookUpSwitchGearType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LookUpSwitchGearTypeExists(lookUpSwitchGearType.SwitchGearTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lookUpSwitchGearType));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("SwitchGearTypeId,SwitchGearTypeName")] LookUpSwitchGearType lookUpSwitchGearType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lookUpSwitchGearType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(lookUpSwitchGearType));
        }