Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Icon")] TableProductCategory tableProductCategory)
        {
            if (id != tableProductCategory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tableProductCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TableProductCategoryExists(tableProductCategory.Id))
                    {
                        return(NotFound());
                    }

                    throw;
                }

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

            return(View(tableProductCategory));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Description,Icon")] TableProductCategory tableProductCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tableProductCategory);
                await _context.SaveChangesAsync();

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

            return(View(tableProductCategory));
        }