public async Task <IActionResult> Edit(int id, [Bind("Id,Pictures,ProductId")] Picture image) { if (id != image.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(image); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ImageExists(image.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", image.ProductId); return(View(image)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Property @property) { if (id != @property.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(@property); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PropertyExists(@property.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(@property)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Link,MenuId")] SubMenu subMenu) { if (id != subMenu.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subMenu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubMenuExists(subMenu.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MenuId"] = new SelectList(_context.Menus, "Id", "Name", subMenu.MenuId); return(View(subMenu)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,MarkaId")] Model model) { if (id != model.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(model); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModelExists(model.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MarkaId"] = new SelectList(_context.Markas, "Id", "Name", model.MarkaId); return(View(model)); }
public async Task <IActionResult> Edit(int id, [Bind("Value,ProductId,PropertyId")] ProductProperty productProperty) { if (id != productProperty.ProductId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productProperty); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductPropertyExists(productProperty.ProductId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", productProperty.ProductId); ViewData["PropertyId"] = new SelectList(_context.Properties, "Id", "Name", productProperty.PropertyId); return(View(productProperty)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,UserName,Description,ProductId")] Comment comment) { if (id != comment.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(comment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentExists(comment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", comment.ProductId); return(View(comment)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Link")] Menu menu) { if (id != menu.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(menu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MenuExists(menu.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(menu)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Star,ProductId")] Rating rating) { if (id != rating.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rating); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RatingExists(rating.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", rating.ProductId); return(View(rating)); }