Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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();
 }