public HttpResponseMessage Inserir(Cliente cliente) { try { _db.Clientes.Add(cliente); _db.SaveChanges(); return Request.CreateResponse(HttpStatusCode.OK, cliente); } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } }
public HttpResponseMessage Alterar(Cliente cliente) { try { _db.Entry(cliente).State = EntityState.Modified; _db.SaveChanges(); return Request.CreateResponse(HttpStatusCode.OK, cliente); } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } }