コード例 #1
0
        public IHttpActionResult PutUserContactDetail(int id, UserContactDetail userContactDetail)
        {
            if (id != userContactDetail.UserContactDetailUID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult PostUserContactDetail(UserContactDetail userContactDetail)
        {
            db.UserContactDetails.Add(userContactDetail);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = userContactDetail.UserContactDetailUID }, userContactDetail));
        }
コード例 #3
0
        public IHttpActionResult GetUserContactDetail(int id)
        {
            UserContactDetail userContactDetail = db.UserContactDetails.Find(id);

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

            return(Ok(userContactDetail));
        }
コード例 #4
0
        public IHttpActionResult DeleteUserContactDetail(int id)
        {
            UserContactDetail userContactDetail = db.UserContactDetails.Find(id);

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

            db.UserContactDetails.Remove(userContactDetail);
            db.SaveChanges();

            return(Ok(userContactDetail));
        }