Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ShipperID,CompanyName")] Shipper shipper)
        {
            if (id != shipper.ShipperId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _shipperService.Edit(shipper);
                }
                catch (Exception)
                {
                    if (!await _shipperService.Exists(shipper.ShipperId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shipper));
        }