public async Task <IActionResult> Create([Bind("CategoryID,Name")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("SupplierID,Name,MobilePhoneNumber,HomePhoneNumber,EmailAddress")] Supplier supplier) { if (ModelState.IsValid) { _context.Add(supplier); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(supplier)); }
public async Task <IActionResult> Create([Bind("OrderItemID,Quantity,OrderItemPrice")] OrderItem orderItem) { if (ModelState.IsValid) { _context.Add(orderItem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(orderItem)); }
public async Task <IActionResult> Create([Bind("ItemID,ItemName,Description,Price,FilePath,CategoryID,SupplierID")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.Categories, "CategoryID", "Name", product.CategoryID); ViewData["SupplierID"] = new SelectList(_context.Suppliers, "SupplierID", "EmailAddress", product.SupplierID); return(View(product)); }
public async Task <IActionResult> EnableDisable(string id) { if (id == null) { return(NotFound()); } IEnumerable <ApplicationUser> members = ReturnAllMembers().Result; ApplicationUser member = (ApplicationUser)members.Single(u => u.Id == id); if (member == null) { return(NotFound()); } member.Enabled = !member.Enabled; _context.Update(member); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); }