예제 #1
0
        // POST: odata/CamposTipos
        public async Task <IHttpActionResult> Post(CamposTipos camposTipos)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CamposTipos.Add(camposTipos);
            await db.SaveChangesAsync();

            return(Created(camposTipos));
        }
예제 #2
0
        // DELETE: odata/CamposTipos(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            CamposTipos camposTipos = await db.CamposTipos.FindAsync(key);

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

            db.CamposTipos.Remove(camposTipos);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        // PUT: odata/CamposTipos(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <CamposTipos> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            CamposTipos camposTipos = await db.CamposTipos.FindAsync(key);

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

            patch.Put(camposTipos);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CamposTiposExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(camposTipos));
        }