Exemple #1
0
        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));
        }
Exemple #2
0
        public IHttpActionResult GetLecturasModel(int id)
        {
            LecturasModel lecturasModel = db.LecturasModels.Find(id);

            if (lecturasModel == null)
            {
                return(NotFound());
            }

            return(Ok(lecturasModel));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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();
 }