public async Task <IActionResult> Create([Bind("Id,Description,Name,Prize")] Pizzas pizzas)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pizzas);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(pizzas));
        }
        public async Task <IActionResult> Create([Bind("Id,Gluten,Name")] Ingredients ingredients, string type)
        {
            if (ModelState.IsValid)
            {
                ingredients.Type = SetingredientsType(type);
                _context.Add(ingredients);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(ingredients));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,Description,Grade,PizzaId,Title")] Reviews reviews)
        {
            if (ModelState.IsValid)
            {
                reviews.Date = DateTime.Now;
                _context.Add(reviews);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["PizzaId"] = new SelectList(_context.Pizzas.OrderBy(r => r.Name), "Id", "Name", reviews.PizzaId);
            return(View(reviews));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,IngredientId,PizzaId")] PizzaIngredients pizzaIngredients)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pizzaIngredients);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["IngredientId"] = new SelectList(_context.Ingredients.OrderBy(i => i.Name), "Id", "Name", pizzaIngredients.IngredientId);
            ViewData["PizzaId"]      = new SelectList(_context.Pizzas.OrderBy(p => p.Name), "Id", "Name", pizzaIngredients.PizzaId);
            return(View(pizzaIngredients));
        }
        public async Task <IActionResult> Create([Bind("Id,City,Country,Date,PizzaId")] Orgins orgins)
        {
            if (ModelState.IsValid)
            {
                if (!OrginsPizzaIdExists(orgins))
                {
                    _context.Add(orgins);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            ViewData["PizzaId"] = new SelectList(_context.Pizzas.Where(x => x.Orgins.PizzaId != x.Id).OrderBy(p => p.Name), "Id", "Name", orgins.PizzaId);
            return(View(orgins));
        }