public IHttpActionResult PutLecturasModel(int id, LecturasModel lecturasModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != lecturasModel.Id) { return(BadRequest()); } db.Entry(lecturasModel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LecturasModelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetLecturasModel(int id) { LecturasModel lecturasModel = db.LecturasModels.Find(id); if (lecturasModel == null) { return(NotFound()); } return(Ok(lecturasModel)); }
public IHttpActionResult PostLecturasModel(LecturasModel lecturasModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LecturasModels.Add(lecturasModel); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = lecturasModel.Id }, lecturasModel)); }
public IHttpActionResult DeleteLecturasModel(int id) { LecturasModel lecturasModel = db.LecturasModels.Find(id); if (lecturasModel == null) { return(NotFound()); } db.LecturasModels.Remove(lecturasModel); db.SaveChanges(); return(Ok(lecturasModel)); }
public string AddLecturas(LecturasModel lectura) { throw new NotImplementedException(); }