public async Task <IActionResult> Edit(string id, [Bind("BrandId,Name")] Brand brand) { if (id != brand.BrandId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(brand); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrandExists(brand.BrandId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(brand)); }
public async Task <IActionResult> Edit(string id, [Bind("ItemCode,ItemName,Category,SubCategory,SupplierId,BrandId,PurchasePrice,SalePrice,EexpireDate,SlideTitle,NewArrivalTitle,Picture")] Items items) { if (id != items.ItemCode) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(items); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemsExists(items.ItemCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.Brand, "BrandId", "BrandId", items.BrandId); ViewData["Category"] = new SelectList(_context.Category, "CategoryName", "CategoryName", items.Category); ViewData["SupplierId"] = new SelectList(_context.Supplier, "SupplierId", "SupplierId", items.SupplierId); return(View(items)); }
public async Task <IActionResult> Edit(string id, [Bind("SupplierId,Name,Address,Mobile")] Supplier supplier) { if (id != supplier.SupplierId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(supplier); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SupplierExists(supplier.SupplierId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(supplier)); }
public async Task <IActionResult> Edit(string id, [Bind("CategoryId,CategoryName,SubCategory,Description,SerialNo")] Category category) { if (id != category.CategoryName) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryName)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }