public IHttpActionResult PutChats_Detalles(int id, Chats_Detalles chats_Detalles) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != chats_Detalles.Id) { return(BadRequest()); } db.Entry(chats_Detalles).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Chats_DetallesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostChats_Detalles(Chats_Detalles chats_Detalles) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } chats_Detalles.Fecha_Mensaje = DateTime.Now; db.Chats_Detalles.Add(chats_Detalles); try { db.SaveChanges(); } catch (DbUpdateException) { if (Chats_DetallesExists(chats_Detalles.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = chats_Detalles.Id }, chats_Detalles)); }
public IHttpActionResult GetChats_Detalles(int id) { Chats_Detalles chats_Detalles = db.Chats_Detalles.Find(id); if (chats_Detalles == null) { return(NotFound()); } return(Ok(chats_Detalles)); }
public IHttpActionResult DeleteChats_Detalles(int id) { Chats_Detalles chats_Detalles = db.Chats_Detalles.Find(id); if (chats_Detalles == null) { return(NotFound()); } db.Chats_Detalles.Remove(chats_Detalles); db.SaveChanges(); return(Ok(chats_Detalles)); }