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

            db.msCtCoreFunctions.Add(msCtCoreFunction);
            await db.SaveChangesAsync();

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

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

            db.msCtCoreFunctions.Remove(msCtCoreFunction);
            await db.SaveChangesAsync();

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

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

            msCtCoreFunction msCtCoreFunction = await db.msCtCoreFunctions.FindAsync(key);

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

            patch.Put(msCtCoreFunction);

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

            return(Updated(msCtCoreFunction));
        }