Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("CategoryID,CategoryName,Description")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ProductId,ProductName,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
Esempio n. 3
0
 public void AddEmployee(Employee employee)
 {
     employee.EmployeeGuid = Guid.NewGuid();
     _ctx.Add(employee);
 }