Example #1
0
        // POST: odata/mdPanelSizesSubs
        public async Task <IHttpActionResult> Post(mdPanelSizesSub mdPanelSizesSub)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.mdPanelSizesSubs.Add(mdPanelSizesSub);
            await db.SaveChangesAsync();

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

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

            db.mdPanelSizesSubs.Remove(mdPanelSizesSub);
            await db.SaveChangesAsync();

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

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

            mdPanelSizesSub mdPanelSizesSub = await db.mdPanelSizesSubs.FindAsync(key);

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

            patch.Put(mdPanelSizesSub);

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

            return(Updated(mdPanelSizesSub));
        }