Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description")] Techniques techniques)
        {
            if (ModelState.IsValid)
            {
                _context.Add(techniques);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(techniques));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Glass glass)
        {
            if (ModelState.IsValid)
            {
                _context.Add(glass);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(glass));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,CategoryId,Description")] Ingredients ingredients)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ingredients);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Name", ingredients.CategoryId);
            return(View(ingredients));
        }
        public async Task <IActionResult> Create([Bind("Id,IngredientId,Amount,CoctailId")] Compounds compounds)
        {
            if (ModelState.IsValid)
            {
                _context.Add(compounds);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CoctailId"]    = new SelectList(_context.Coctails, "Id", "Name", compounds.CoctailId);
            ViewData["IngredientId"] = new SelectList(_context.Ingredients, "Id", "Name", compounds.IngredientId);
            return(View(compounds));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id,Name,YearofCreation,CountryofCreationId,CreationHistory,StrengthId,TechniqueId,GlassId,Recipe")] Coctails coctails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(coctails);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Create", "Compounds"));
            }
            ViewData["CountryofCreationId"] = new SelectList(_context.Country, "Id", "Name", coctails.CountryofCreationId);
            ViewData["GlassId"]             = new SelectList(_context.Glass, "Id", "Name", coctails.GlassId);
            ViewData["StrengthId"]          = new SelectList(_context.Strengths, "Id", "Name", coctails.StrengthId);
            ViewData["TechniqueId"]         = new SelectList(_context.Techniques, "Id", "Name", coctails.TechniqueId);
            return(View(coctails));
        }