コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();   // problem Service kullanılmadan yapıyor.

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
コード例 #2
0
 public void AddProduct(Product product)
 {
     dbContext.Add(product);
     dbContext.SaveChanges();
 }