示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("InsulatorDiskTypeId,InsulatorDiskTypeName")] LookUpInsulatorDiskType lookUpInsulatorDiskType)
        {
            if (id != lookUpInsulatorDiskType.InsulatorDiskTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lookUpInsulatorDiskType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LookUpInsulatorDiskTypeExists(lookUpInsulatorDiskType.InsulatorDiskTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lookUpInsulatorDiskType));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("InsulatorDiskTypeId,InsulatorDiskTypeName")] LookUpInsulatorDiskType lookUpInsulatorDiskType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lookUpInsulatorDiskType);
                await _context.SaveChangesAsync();

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