public async Task <IActionResult> PutTiposDocumento(int id, TiposDocumento tiposDocumento) { if (id != tiposDocumento.ID) { return(BadRequest()); } _context.Entry(tiposDocumento).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TiposDocumentoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAperturaDeGavetas(int id, AperturaDeGavetas aperturaDeGavetas) { if (id != aperturaDeGavetas.ID) { return(BadRequest()); } _context.Entry(aperturaDeGavetas).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AperturaDeGavetasExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutSucursales(int id, Sucursales sucursales) { if (id != sucursales.ID) { return(BadRequest()); } _context.Entry(sucursales).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SucursalesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutMediosDePago(int id, MediosDePago mediosDePago) { if (id != mediosDePago.ID) { return(BadRequest()); } _context.Entry(mediosDePago).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MediosDePagoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,Nome,Cpf")] Funcionario funcionario) { if (ModelState.IsValid) { _context.Add(funcionario); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(funcionario)); }
public async Task <IActionResult> Create([Bind("Id,Nome,Cpf,DataNascimento")] Cliente cliente) { if (ModelState.IsValid) { _context.Add(cliente); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public async Task <IActionResult> Create([Bind("Id,Nome,Email,DataAniversario,DataInscricao,PlanoId")] Cliente cliente) { if (ModelState.IsValid) { _context.Add(cliente); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PlanoId"] = new SelectList(_context.Planos, "Id", "Id", cliente.PlanoId); return(View(cliente)); }
public async Task <IActionResult> Create([Bind("Id,Descricao,ClienteId")] Produto produto) { if (ModelState.IsValid) { _context.Add(produto); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClienteId"] = new SelectList(_context.Cliente, "Id", "Nome", produto.ClienteId); return(View(produto)); }
public async Task <IActionResult> PutOrden(int id, Orden orden) { if (id != orden.ID) { return(BadRequest()); } _context.Entry(orden).State = EntityState.Modified; foreach (var productoOrden in orden.ProductosPorOrden) { if (productoOrden.ID == 0) { productoOrden.Productos = null; await _context.ProductosPorOrden.AddAsync(productoOrden); } else { _context.Entry(productoOrden).State = EntityState.Modified; } } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrdenExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task DeleteAsync(Tentity entity) { _dbcontext.Set <Tentity>().Remove(entity); await _dbcontext.SaveChangesAsync(); }