Beispiel #1
0
        public void UpdateUser(Models.Users user)

        {
            DBcontext.Entry(user).State = EntityState.Modified;

            DBcontext.SaveChanges();
        }
        // PUT api/Chats/5
        public HttpResponseMessage PutChat(int id, Chat.Models.Chat chat)
        {
            if (ModelState.IsValid && id == chat.ChatID)
            {
                db.Entry(chat).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }