public async Task <IActionResult> Edit(int id, [Bind("CategoryID,Name")] Category category) { if (id != category.CategoryID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("OfferID,Title,Description,NewPrice,OldPrice,DeliveryPrice,EndDate,Link,DiscountCode,Image,IsAvaliable")] Offer offer) { if (id != offer.OfferID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(offer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OfferExists(offer.OfferID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(offer)); }