Exemple #1
0
        public IHttpActionResult Patch([FromODataUri] decimal key, Delta <ADMININFO> patch)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ADMININFO aDMININFO = db.ADMININFOes.Find(key);

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

            patch.Patch(aDMININFO);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ADMININFOExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(aDMININFO));
        }
Exemple #2
0
        // PUT: odata/ADMININFOes(5)
        public IHttpActionResult Put([FromODataUri] decimal key, ADMININFO aDMININFO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (key != aDMININFO.ID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ADMININFOExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(aDMININFO));
        }
Exemple #3
0
        // POST: odata/ADMININFOes
        public IHttpActionResult Post(ADMININFO aDMININFO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ADMININFOes.Add(aDMININFO);
            db.SaveChanges();

            return(Created(aDMININFO));
        }
Exemple #4
0
        // DELETE: odata/ADMININFOes(5)
        public IHttpActionResult Delete([FromODataUri] decimal key)
        {
            ADMININFO aDMININFO = db.ADMININFOes.Find(key);

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

            db.ADMININFOes.Remove(aDMININFO);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }