public IHttpActionResult PutTicket(int id, Ticket ticket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ticket.Id) { return(BadRequest()); } db.Entry(ticket).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TicketExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public int Alterar(Status status) { try { using (HelpDeskEntities contexto = new HelpDeskEntities(Util.ConnectionString)) { contexto.Entry(status).State = System.Data.EntityState.Modified; return(contexto.SaveChanges()); } } catch (Exception) { return(-1); } }
public int Gravar(Solicitante sol) { try { using (HelpDeskEntities contexto = new HelpDeskEntities(Util.ConnectionString)) { contexto.Solicitante.Add(sol); return(contexto.SaveChanges()); } } catch (Exception) { return(-1); } }