Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Number,Name,Price")] ProductViewModel productViewModel)
        {
            if (id != productViewModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _ds.UpdateAsync(productViewModel);
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(NotFound());
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productViewModel));
        }