コード例 #1
0
        public IHttpActionResult PutrangosPreciosModel(rangosPreciosModel rangosPreciosModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //if (id != rangosPreciosModel.idRango)
            //{
            //    return BadRequest();
            //}

            db.Entry(rangosPreciosModel).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(BadRequest(ex.Message));
                //if (!rangosPreciosModelExists(id))
                //{
                //    return NotFound();
                //}
                //else
                //{
                //    throw;
                //}
            }

            return(StatusCode(HttpStatusCode.OK));
        }
コード例 #2
0
        public IHttpActionResult GetrangosPreciosModel(long id)
        {
            rangosPreciosModel rangosPreciosModel = db.rangosPreciosModels.Find(id);

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

            return(Ok(rangosPreciosModel));
        }
コード例 #3
0
        public IHttpActionResult PostrangosPreciosModel(rangosPreciosModel rangosPreciosModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.rangosPreciosModels.Add(rangosPreciosModel);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = rangosPreciosModel.idRango }, rangosPreciosModel));
        }
コード例 #4
0
        public IHttpActionResult DeleterangosPreciosModel(long id)
        {
            rangosPreciosModel rangosPreciosModel = db.rangosPreciosModels.Find(id);

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

            db.rangosPreciosModels.Remove(rangosPreciosModel);
            db.SaveChanges();

            return(Ok(rangosPreciosModel));
        }