public async Task <IActionResult> Edit(byte id, [Bind("HeadingItem_id,Link,Name,HasChildren,Parent,Item_Column")] HeadingMenu headingMenu) { if (id != headingMenu.HeadingItem_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(headingMenu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HeadingMenuExists(headingMenu.HeadingItem_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(headingMenu)); }
public async Task <IActionResult> Edit(long id, [Bind("Ordered_id,ProductVariant_Id,Order_Id,Amount")] Ordered ordered) { if (id != ordered.Ordered_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ordered); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderedExists(ordered.Ordered_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Order_Id"] = new SelectList(_context.Orders, "Order_id", "UserId", ordered.Order_Id); ViewData["ProductVariant_Id"] = new SelectList(_context.ProductVariants, "ProductVariant_Id", "ProductVariant_Id", ordered.ProductVariant_Id); return(View(ordered)); }
public async Task <IActionResult> Edit(long id, [Bind("ProductVariant_Id,Product_id,Size_id,Color_id,Quantity")] ProductVariant productVariant) { if (id != productVariant.ProductVariant_Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productVariant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductVariantExists(productVariant.ProductVariant_Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Color_id"] = new SelectList(_context.Colors, "Color_id", "Name", productVariant.Color_id); ViewData["Product_id"] = new SelectList(_context.Products, "Product_id", "Description", productVariant.Product_id); ViewData["Size_id"] = new SelectList(_context.Sizes, "Size_id", "Name", productVariant.Size_id); return(View(productVariant)); }
public async Task <IActionResult> Edit(long id, [Bind("Price_id,Net_price,Discount,Active,Product_id")] Price price) { if (id != price.Price_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(price); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PriceExists(price.Price_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Product_id"] = new SelectList(_context.Products, "Product_id", "Description", price.Product_id); return(View(price)); }
public async Task <IActionResult> Edit(byte id, [Bind("Subcategory_id,Name")] Subcategory subcategory) { if (id != subcategory.Subcategory_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subcategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubcategoryExists(subcategory.Subcategory_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(subcategory)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,Name")] Role role) { if (id != role.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var r = _context.Roles.Find(role.Id); r.Name = role.Name; _context.Update(r); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleExists(role.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(role)); }
public async Task <IActionResult> Edit(int id, [Bind("Option_id,Name,Poll_id")] Option option) { if (id != option.Option_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(option); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OptionExists(option.Option_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Poll_id"] = new SelectList(_context.Polls, "Poll_id", "Question", option.Poll_id); return(View(option)); }
public async Task <IActionResult> Edit(int id, [Bind("FooterItem_id,Link,Name")] FooterMenu footerMenu) { if (id != footerMenu.FooterItem_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(footerMenu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FooterMenuExists(footerMenu.FooterItem_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(footerMenu)); }
public async Task <IActionResult> Edit(short id, [Bind("Type_id,Name")] Type @type) { if (id != @type.Type_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(@type); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeExists(@type.Type_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(@type)); }
public async Task <IActionResult> Edit(int id, [Bind("Rating_id,Product_id,UserId,Value")] Rating rating) { if (id != rating.Rating_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rating); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RatingExists(rating.Rating_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Product_id"] = new SelectList(_context.Products, "Product_id", "Description", rating.Product_id); ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", rating.UserId); return(View(rating)); }
public async Task <IActionResult> Edit(short id, [Bind("Poll_id,Question,Active")] Poll poll) { if (id != poll.Poll_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(poll); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PollExists(poll.Poll_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(poll)); }
public async Task <IActionResult> Edit(int id, [Bind("Order,CategoryId,BrandId,ImageUrl,Price,Manufacturer,Gender,Id,Name")] Product product) { if (id != product.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.Brands, "Id", "Id", product.BrandId); ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Id", product.CategoryId); return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("Product_id,Name,Description,Category_id,Subcategory_id,Type_id")] Product product) { if (id != product.Product_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.Product_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Category_id"] = new SelectList(_context.Categories, "Category_id", "Name", product.Category_id); ViewData["Subcategory_id"] = new SelectList(_context.Subcategories, "Subcategory_id", "Name", product.Subcategory_id); ViewData["Type_id"] = new SelectList(_context.Types, "Type_id", "Name", product.Type_id); return(View(product)); }
public async Task <IActionResult> Edit(byte id, [Bind("Color_id,Name")] Color color) { if (id != color.Color_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(color); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ColorExists(color.Color_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(color)); }
public async Task <IActionResult> Edit(int id, [Bind("Photo_id,Source,Alt,Slider_id")] SliderPhoto sliderPhoto) { if (id != sliderPhoto.Photo_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sliderPhoto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SliderPhotoExists(sliderPhoto.Photo_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Slider_id"] = new SelectList(_context.Sliders, "Slider_id", "Text", sliderPhoto.Slider_id); return(View(sliderPhoto)); }
public async Task <IActionResult> Edit(long id, [Bind("Vote_id,UserId,Time,Option_id")] Vote vote) { if (id != vote.Vote_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vote); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VoteExists(vote.Vote_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Option_id"] = new SelectList(_context.Options, "Option_id", "Name", vote.Option_id); ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", vote.UserId); return(View(vote)); }
public async Task <IActionResult> Edit(int id, [Bind("Photo_id,Source,Alt,Product_id")] ProductPhoto productPhoto) { if (id != productPhoto.Photo_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productPhoto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductPhotoExists(productPhoto.Photo_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Product_id"] = new SelectList(_context.Products, "Product_id", "Description", productPhoto.Product_id); return(View(productPhoto)); }
public async Task <IActionResult> Edit(int id, [Bind("Slider_id,Active,Title,Text")] Slider slider) { if (id != slider.Slider_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(slider); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SliderExists(slider.Slider_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(slider)); }
public void Put(WebStoreContext db, User user) { db.Update(user); db.SaveChanges(); }
public void Put(WebStoreContext db, Product product) { db.Update(product); db.SaveChanges(); }