diff --git a/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs b/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs index 65050d74..01c3d774 100644 --- a/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs +++ b/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs @@ -21,14 +21,6 @@ namespace Yavsc.Controllers _context = context; } - // GET: api/CommentsApi - [HttpGet] - public IEnumerable GetComment() - { - return _context.Comment; - } - - // GET: api/CommentsApi/5 [HttpGet("{id}", Name = "GetComment")] public async Task GetComment([FromRoute] long id) { @@ -46,45 +38,8 @@ namespace Yavsc.Controllers return Ok(comment); } - - // PUT: api/CommentsApi/5 - [HttpPut("{id}")] - public async Task PutComment([FromRoute] long id, [FromBody] Comment comment) - { - if (!ModelState.IsValid) - { - return BadRequest(ModelState); - } - - if (id != comment.Id) - { - return BadRequest(); - } - - _context.Entry(comment).State = EntityState.Modified; - - try - { - await _context.SaveChangesAsync(User.GetUserId()); - } - catch (DbUpdateConcurrencyException) - { - if (!CommentExists(id)) - { - return NotFound(); - } - else - { - throw; - } - } - - return new StatusCodeResult(StatusCodes.Status204NoContent); - } - - // POST: api/CommentsApi [HttpPost] - public async Task PostComment([FromBody] CommentPost post) + public async Task Post([FromBody] CommentPost post) { if (!ModelState.IsValid) { @@ -131,12 +86,12 @@ namespace Yavsc.Controllers throw; } } - return CreatedAtRoute("GetComment", new { id = c.Id }, post); + return CreatedAtRoute("GetComment", new { id = c.Id }, new { id = c.Id, dateCreated = c.DateCreated }); } // DELETE: api/CommentsApi/5 [HttpDelete("{id}")] - public async Task DeleteComment([FromRoute] long id) + public async Task Delete([FromRoute] long id) { if (!ModelState.IsValid) { diff --git a/src/Yavsc/Views/Blogspot/Details.cshtml b/src/Yavsc/Views/Blogspot/Details.cshtml index 3dacd1f1..da8cd242 100644 --- a/src/Yavsc/Views/Blogspot/Details.cshtml +++ b/src/Yavsc/Views/Blogspot/Details.cshtml @@ -7,7 +7,7 @@