public IHttpActionResult PostClientes(Entities.Clientes clientes) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Clientes.Add(clientes); try { db.SaveChanges(); } catch (DbUpdateException) { if (ClientesExists(clientes.Identificacion)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = clientes.Identificacion }, clientes)); }
public IHttpActionResult PutClientes(long id, Entities.Clientes clientes) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != clientes.Identificacion) { return(BadRequest()); } db.Entry(clientes).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClientesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetClientes(long id) { Entities.Clientes clientes = db.Clientes.Find(id); if (clientes == null) { return(NotFound()); } return(Ok(clientes)); }
public IHttpActionResult DeleteClientes(long id) { Entities.Clientes clientes = db.Clientes.Find(id); if (clientes == null) { return(NotFound()); } db.Clientes.Remove(clientes); db.SaveChanges(); return(Ok(clientes)); }
public void InicializarFormulario(FormMode op, Entities.Clientes clienteSelected) { formMode = op; oClienteSelected = clienteSelected; }