public async Task <IActionResult> Edit(int id, [Bind("CategoryId,Brand,ForGender")] 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("ToyId,ToyName,Price,AgeGroup,ToyRating,CategoryID")] Toy toy) { if (id != toy.ToyId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(toy); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ToyExists(toy.ToyId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.Category, "CategoryId", "CategoryId", toy.CategoryID); return(View(toy)); }
public async Task <IActionResult> Edit(int id, [Bind("ToyRelId,InStock,AvailableQuantity,ToyId,ToyStoreId")] ToyRel toyRel) { if (id != toyRel.ToyRelId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(toyRel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ToyRelExists(toyRel.ToyRelId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ToyId"] = new SelectList(_context.Toy, "ToyId", "ToyId", toyRel.ToyId); ViewData["ToyStoreId"] = new SelectList(_context.ToyStore, "ToyStoreId", "ToyStoreId", toyRel.ToyStoreId); return(View(toyRel)); }
public async Task <IActionResult> Edit(int id, [Bind("ToyStoreId,StoreNAme,City,Phone,OpeningTime,ClosingTime")] ToyStore toyStore) { if (id != toyStore.ToyStoreId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(toyStore); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ToyStoreExists(toyStore.ToyStoreId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(toyStore)); }