public IHttpActionResult PutStory(int id, Story story)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

            unitOfWork.Stories.Update(story);

            try
            {
                unitOfWork.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!unitOfWork.Stories.IsExist(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PostStory(Story story)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            unitOfWork.Stories.Add(story);
            unitOfWork.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = story.Id }, story);
        }
Example #3
0
 public void AddRoomStory(Story story, int roomId)
 {
     Clients.All.showNewStory(story.Id, story.IsEstimated, story.Name, story.Points, roomId);
 }