Exemplo n.º 1
0
        public async Task <int> DeleteUserNewComment(DeleteNewCommentsViewModel input)
        {
            var newComment = newCommentDbSet.All().Where(x => x.Id == input.Id).FirstOrDefault();

            newCommentDbSet.Delete(newComment);
            await newCommentDbSet.SaveChangesAsync();

            return((int)newComment.NewId);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteNewComment(DeleteNewCommentsViewModel input)
        {
            if (!ModelState.IsValid)
            {
                return(View(input));
            }

            int newId = await newCommentService.DeleteUserNewComment(input);

            return(this.RedirectToAction("PreviewNew", "News", new { id = newId }));
        }