Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ID,Name,EmailAddress")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,Name,Abbreviation,IsBaseUnit")] Unit unit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(unit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(unit));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ID,Name,CostPer100g,WeightPerUnit")] Ingredient ingredient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ingredient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ingredient));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("ID,Name")] Book book)
        {
            if (ModelState.IsValid)
            {
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("ID,Name,PageNumber,MakeAhead,LongerRecipe,GoodToFreeze,IngredientsComplete,StepsComplete")] Recipe recipe)
        {
            if (ModelState.IsValid)
            {
                _context.Add(recipe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(recipe));
        }