public async Task <IActionResult> Create([Bind("Id,Name,Info")] Store store) { if (ModelState.IsValid) { _context.Add(store); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(store)); }
public async Task <IActionResult> Create([Bind("Id", "Name")] Country country) { if (ModelState.IsValid) { _context.Add(country); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Create([Bind("Id,Name,Price,Year,Info,BrandId")] Bicycle bicycle) { if (ModelState.IsValid) { _context.Add(bicycle); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.Brands, "Id", "Name", bicycle.BrandId); return(View(bicycle)); }
public async Task <IActionResult> Create([Bind("Id,Name,Info,CountryId")] Brand brand) { if (ModelState.IsValid) { _context.Add(brand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Name", brand.CountryId); return(View(brand)); }
public async Task <IActionResult> Create([Bind("Id,BicycleId,StoreId")] Sale sale) { if (ModelState.IsValid) { _context.Add(sale); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BicycleId"] = new SelectList(_context.Bicycles, "Id", "Name", sale.BicycleId); ViewData["StoreId"] = new SelectList(_context.Stores, "Id", "Name", sale.StoreId); return(View(sale)); }