public async Task <IActionResult> Create([Bind("ID,Name")] Squad squad) { if (ModelState.IsValid) { _context.Add(squad); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(squad)); }
public async Task <IActionResult> Create([Bind("ID,Description,ImageFileName,SellingPrice,ShortName")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(product)); }
public async Task <IActionResult> Create([Bind("ID,FirstName,SquadID,StartDate,Surname")] Coach coach) { if (ModelState.IsValid) { _context.Add(coach); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } PopulateSquadsDropDownList(coach.SquadID); return(View(coach)); }
public async Task <IActionResult> Create([Bind("ItemId,CartId,DateCreated,ProductId,Quantity")] CartItem cartItem) { if (ModelState.IsValid) { _context.Add(cartItem); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["ProductId"] = new SelectList(_context.Products, "ID", "ID", cartItem.ProductId); return(View(cartItem)); }
public async Task <IActionResult> Create([Bind("ID,ASANumber,DOB,FirstName,SquadID,StartDate,Surname,photo")] Swimmer swimmer) { if (ModelState.IsValid) { _context.Add(swimmer); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } PopulateSquadsDropDownList(swimmer.SquadID); //ViewData["SquadID"] = new SelectList(_context.Squads, "ID", "ID", swimmer.SquadID); return(View(swimmer)); }