public IHttpActionResult Post(PostAReplyToAComment model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateReplyService(); if (!service.CreateReply(model)) { return(InternalServerError()); } return(Ok()); }
// Post Reply public bool CreateReply(PostAReplyToAComment model) { var entity = new Reply() { AuthorId = _userId, Text = model.Text }; using (var ctx = new ApplicationDbContext()) { ctx.Replies.Add(entity); return(ctx.SaveChanges() == 1); } }