public async Task <IActionResult> Edit(string id, [Bind("ItemId,CartId,DateCreated,ProductId,Quantity")] CartItem cartItem) { if (id != cartItem.ItemId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cartItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CartItemExists(cartItem.ItemId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["ProductId"] = new SelectList(_context.Products, "ID", "ID", cartItem.ProductId); return(View(cartItem)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] Squad squad) { if (id != squad.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(squad); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SquadExists(squad.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(squad)); }
public async Task <IActionResult> AddToCart(int id, [Bind("ID,Description,ImageFileName,SellingPrice,ShortName")] 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("Index")); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,SquadID,StartDate,Surname")] Coach coach) { if (id != coach.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(coach); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CoachExists(coach.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } PopulateSquadsDropDownList(coach.SquadID); return(View(coach)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,ASANumber,DOB,FirstName,SquadID,StartDate,Surname,photo")] Swimmer swimmer) { if (id != swimmer.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(swimmer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SwimmerExists(swimmer.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } PopulateSquadsDropDownList(swimmer.SquadID); //ViewData["SquadID"] = new SelectList(_context.Squads, "ID", "ID", swimmer.SquadID); return(View(swimmer)); }