public IHttpActionResult PutStCliente(int id, StCliente stCliente) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stCliente.IDstCliente) { return(BadRequest()); } db.Entry(stCliente).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!StClienteExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetStCliente(int id) { StCliente stCliente = db.StCliente.Find(id); if (stCliente == null) { return(NotFound()); } return(Ok(stCliente)); }
public IHttpActionResult PostStCliente(StCliente stCliente) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.StCliente.Add(stCliente); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = stCliente.IDstCliente }, stCliente)); }
public IHttpActionResult DeleteStCliente(int id) { StCliente stCliente = db.StCliente.Find(id); if (stCliente == null) { return(NotFound()); } db.StCliente.Remove(stCliente); db.SaveChanges(); return(Ok(stCliente)); }