Пример #1
0
 //Inserir o objeto obj no banco de dados
 public async Task InsertAsync(Seller obj)
 {
     obj.Department = _context.Department.First();
     _context.Add(obj);
     //Para confirmar a operação no Banco de Dados
     await _context.SaveChangesAsync();
 }
Пример #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));
        }