public async Task <IActionResult> Create([Bind("CategoryId,Brand,ForGender")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("ToyStoreId,StoreNAme,City,Phone,OpeningTime,ClosingTime")] ToyStore toyStore) { if (ModelState.IsValid) { _context.Add(toyStore); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(toyStore)); }
public async Task <IActionResult> Create([Bind("ToyId,ToyName,Price,AgeGroup,ToyRating,CategoryID")] Toy toy) { if (ModelState.IsValid) { _context.Add(toy); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.Category, "CategoryId", "CategoryId", toy.CategoryID); return(View(toy)); }
public async Task <IActionResult> Create([Bind("ToyRelId,InStock,AvailableQuantity,ToyId,ToyStoreId")] ToyRel toyRel) { if (ModelState.IsValid) { _context.Add(toyRel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ToyId"] = new SelectList(_context.Toy, "ToyId", "ToyId", toyRel.ToyId); ViewData["ToyStoreId"] = new SelectList(_context.ToyStore, "ToyStoreId", "ToyStoreId", toyRel.ToyStoreId); return(View(toyRel)); }