示例#1
0
        public IHttpActionResult PostTMS_Settings(TMS_Settings tMS_Settings)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TMS_Settings.Add(tMS_Settings);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TMS_SettingsExists(tMS_Settings.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tMS_Settings.Id }, tMS_Settings));
        }
示例#2
0
        public IHttpActionResult PutTMS_Settings(Guid id, TMS_Settings tMS_Settings)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tMS_Settings.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public IHttpActionResult GetTMS_Settings(Guid id)
        {
            TMS_Settings tMS_Settings = db.TMS_Settings.Find(id);

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

            return(Ok(tMS_Settings));
        }
示例#4
0
        public IHttpActionResult DeleteTMS_Settings(Guid id)
        {
            TMS_Settings tMS_Settings = db.TMS_Settings.Find(id);

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

            db.TMS_Settings.Remove(tMS_Settings);
            db.SaveChanges();

            return(Ok(tMS_Settings));
        }