Ejemplo n.º 1
0
        public IActionResult Delete(int?id)
        {
            if (!id.HasValue)
            {
                return(BadRequest());
            }

            try
            {
                _commentsService.Delete(id.Value);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(BadRequest());
            }
            return(Ok());
        }
        public IActionResult Delete(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("List", "UserJobOffers"));
            }

            CommentEditViewModel model = commentsService.GetById(id.Value);

            if (model == null)
            {
                return(RedirectToAction("List", "UserJobOffers"));
            }

            commentsService.Delete(model.Id);

            return(RedirectToAction("Details", "UserJobOffers", new { id = model.JobOfferId }));
        }
        public IActionResult Delete(int id)
        {
            var comment = _commentsService.GetById(id);

            if (comment == null)
            {
                return(RedirectToAction("ErrorNotFound", "Info"));
            }

            if (comment.UserId != int.Parse(User.FindFirst("Id").Value))
            {
                return(RedirectToAction("AccessDenied", "Auth"));
            }

            _commentsService.Delete(comment);

            return(RedirectToAction("Details", "Recipes", new { id = comment.RecipeId }));
        }
Ejemplo n.º 4
0
        public IActionResult Delete(int id, int eventId)
        {
            var response = _commentsService.Delete(id);

            try
            {
                if (response.IsSuccessful)
                {
                    return(RedirectToAction("MoreInfo", "Events", new { SuccessMessage = "Comment deleted sucessfully", id = eventId }));
                }
                else
                {
                    return(RedirectToAction("MoreInfo", "Events", new { ErrorMessage = response.Message, id = eventId }));
                }
            }
            catch (Exception)
            {
                return(RedirectToAction("ErrorNotFound", "Info"));
            }
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Delete([FromQuery] CommentDeleteContract contract)
        {
            _ = await _service.Delete(contract);

            return(Ok());
        }
Ejemplo n.º 6
0
 public ActionResult DeleteComment(int commentId, string subjectTitle)
 {
     _commentsService.Delete(commentId);
     return(Redirect(String.Format("/Subjects/Subject?title={}", subjectTitle)));
 }
Ejemplo n.º 7
0
        public async Task <IActionResult> Delete(string id)
        {
            await _commentsService.Delete(id);

            return(Ok());
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Delete([FromRoute] Guid couponId, [FromRoute] Guid commentId)
        {
            await _commentsService.Delete(couponId, commentId);

            return(NoContent());
        }