コード例 #1
0
        public IHttpActionResult PutAleMenachoFriends(int id, AleMenachoFriends aleMenachoFriends)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != aleMenachoFriends.FriendId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult GetAleMenachoFriends(int id)
        {
            AleMenachoFriends aleMenachoFriends = db.AleMenachoFriends.Find(id);

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

            return(Ok(aleMenachoFriends));
        }
コード例 #3
0
        public IHttpActionResult PostAleMenachoFriends(AleMenachoFriends aleMenachoFriends)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AleMenachoFriends.Add(aleMenachoFriends);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = aleMenachoFriends.FriendId }, aleMenachoFriends));
        }
コード例 #4
0
        public IHttpActionResult DeleteAleMenachoFriends(int id)
        {
            AleMenachoFriends aleMenachoFriends = db.AleMenachoFriends.Find(id);

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

            db.AleMenachoFriends.Remove(aleMenachoFriends);
            db.SaveChanges();

            return(Ok(aleMenachoFriends));
        }