public async Task <IActionResult> Create([Bind("Id,Name,Country")] Artist artist) { if (ModelState.IsValid) { _context.Add(artist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(artist)); }
public async Task <IActionResult> Create([Bind("Id,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("Id,Name,CartId")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CartId"] = new SelectList(_context.Cart, "Id", "Id", customer.CartId); return(View(customer)); }
public async Task <IActionResult> Create([Bind("Id,Date,Address,TotalPrice,CartId")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CartId"] = new SelectList(_context.Cart, "Id", "Id", order.CartId); return(View(order)); }
public async Task <IActionResult> Create([Bind("Id,Price,Click,Quantity,Name,ImageURL,Information,ArtistId,CategoryId")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ArtistId"] = new SelectList(_context.Artist, "Id", "Name", product.ArtistId); ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", product.CategoryId); return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,Quantity,CartId,ProductId")] CartItem cartItem) { if (ModelState.IsValid) { _context.Add(cartItem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CartId"] = new SelectList(_context.Cart, "Id", "Id", cartItem.CartId); ViewData["ProductId"] = new SelectList(_context.Set <Product>(), "Id", "Name", cartItem.ProductId); return(View(cartItem)); }