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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }