public async Task InsertAsync(Seller obj)
        {
            _context.Add(obj);

            // este é o método que de fato executado o comando SQL no banco,
            // por isso é nele que se colocar o recurso Async
            await _context.SaveChangesAsync();
        }
示例#2
0
 public async Task Add(Seller seller)
 {
     if (seller == null)
     {
         throw new NullReferenceException("Seller was null");
     }
     _context.Seller.Add(seller);
     await _context.SaveChangesAsync();
 }
        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));
        }
示例#4
0
 public async Task InsertAsync(Seller obj)
 {
     _context.Add(obj);
     await _context.SaveChangesAsync();
 }
示例#5
0
 public async Task InsertAsync(Departament departament)
 {
     _context.Add(departament);
     await _context.SaveChangesAsync();
 }