// POST: odata/msProtectionFunctions
        public async Task <IHttpActionResult> Post(msProtectionFunction msProtectionFunction)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.msProtectionFunctions.Add(msProtectionFunction);
            await db.SaveChangesAsync();

            return(Created(msProtectionFunction));
        }
        // DELETE: odata/msProtectionFunctions(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            msProtectionFunction msProtectionFunction = await db.msProtectionFunctions.FindAsync(key);

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

            db.msProtectionFunctions.Remove(msProtectionFunction);
            await db.SaveChangesAsync();

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

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

            msProtectionFunction msProtectionFunction = await db.msProtectionFunctions.FindAsync(key);

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

            patch.Put(msProtectionFunction);

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

            return(Updated(msProtectionFunction));
        }