コード例 #1
0
        public async Task <IActionResult> Create([Bind("IdDepto,strDepto")] Departamento departamento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departamento);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departamento));
        }
コード例 #2
0
ファイル: VendasService.cs プロジェクト: emnetojf/SisVendas
 // Insert: Vendas
 public async Task InsertAsync(Vendas vendas)
 {
     try
     {
         _context.Add(vendas);
         await _context.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #3
0
 // Insert: Cliente
 public async Task InsertAsync(Cliente cliente)
 {
     try
     {
         _context.Add(cliente);
         await _context.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #4
0
 // Insert: Produto
 public async Task InsertAsync(Produto produto)
 {
     try
     {
         _context.Add(produto);
         await _context.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #5
0
 // Insert: Pagtos
 public async Task InsertAsync(FormaPagto formaPagto)
 {
     try
     {
         _context.Add(formaPagto);
         await _context.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }