コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,PriceS,PriceM,PriceL,Crust")] Pizza pizza)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pizza);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pizza));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,RowVersion")] Ingredient ingredient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ingredient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ingredient));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,PizzaName,Price")] OurPizzas ourPizzas)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ourPizzas);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ourPizzas));
        }
コード例 #4
0
 public void Add(AStore genericType)
 {
     context.Add(mapperStore.Map(genericType));
     context.SaveChanges();
 }