Exemple #1
0
        public async Task InsertAsync(Seller obj)
        {
            // obj.Department = _context.Department.First(); // ta pegando o primeiro departamento pra nao dar erro (porem nao precisa mais)

            _context.Add(obj);
            await _context.SaveChangesAsync();
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

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