public async Task <IActionResult> Create([Bind("ID,Nombre,FechaApertura")] Tienda tienda) { if (ModelState.IsValid) { _context.Add(tienda); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tienda)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Color color) { if (ModelState.IsValid) { _context.Add(color); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(color)); }
public async Task <IActionResult> Create([Bind("Id,Code,Name,Description,ImageUri,ColorId,CategoryId,GenderId")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Id", product.CategoryId); ViewData["ColorId"] = new SelectList(_context.Colors, "Id", "Id", product.ColorId); ViewData["GenderId"] = new SelectList(_context.Genders, "Id", "Id", product.GenderId); return(View(product)); }
/// <summary> /// create a new basket for an user /// </summary> /// <param name="basket">the basket obj on registration</param> /// <returns>basket is added to the db</returns> public async Task CreateBasket(Basket basket) { _context.Add(basket); await _context.SaveChangesAsync(); }