예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,Name")] TblVendorType tblVendorType)
        {
            if (id != tblVendorType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblVendorType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblVendorTypeExists(tblVendorType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblVendorType));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] TblVendorType tblVendorType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblVendorType);
                await _context.SaveChangesAsync();

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