public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerId,SaledDate,CategoryId,ItemId,ItemCount,TotalBill")] SaledItems saledItems) { if (id != saledItems.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(saledItems); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SaledItemsExists(saledItems.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Description", saledItems.CategoryId); ViewData["CustomerId"] = new SelectList(_context.Users, "Id", "Name", saledItems.CustomerId); ViewData["ItemId"] = new SelectList(_context.Items, "Id", "Color", saledItems.ItemId); return(View(saledItems)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Url,Count")] PageViewCount pageViewCount) { if (id != pageViewCount.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pageViewCount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PageViewCountExists(pageViewCount.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pageViewCount)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email,UserRole,Password,Mobile")] Users users) { if (id != users.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(users); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersExists(users.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(users)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address,VendorCompany,VendorEmail")] Vendor vendor) { if (id != vendor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vendor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorExists(vendor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(vendor)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Image,TotalItems")] Categories categories) { if (id != categories.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(categories); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriesExists(categories.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(categories)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Quantity,PerItemPrice,Images,Color,Model,CategoryId,VendorId")] Items items) { if (id != items.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(items); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemsExists(items.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Description", items.CategoryId); ViewData["VendorId"] = new SelectList(_context.Vendor, "Id", "Name", items.VendorId); return(View(items)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ItemCategory,Item,ItemCount,PurchasedDate,PerItemPrice")] PurchasedItems purchasedItems) { if (id != purchasedItems.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(purchasedItems); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PurchasedItemsExists(purchasedItems.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ItemCategory"] = new SelectList(_context.Categories, "Id", "Description", purchasedItems.ItemCategory); ViewData["Item"] = new SelectList(_context.Items, "Id", "Color", purchasedItems.Item); return(View(purchasedItems)); }