Exemple #1
0
        public ActionResult DeleteComment(long id)
        {
            var comment = _commentManager.GetById(id);

            _commentManager.Delete(comment);
            return(RedirectToRoute("ServicePage", new { id = comment.id_service }));
        }
Exemple #2
0
        public bool DeleteComment(int commentId)
        {
            var comment = commentManager.GetById(commentId);

            if (Convert.ToInt32(User.Identity.GetUserId()) == comment.UserId)
            {
                return(commentManager.Delete(comment) == true ? true : false);
            }
            else
            {
                return(false);
            }
        }
        public async Task <HttpResponseMessage> DeleteComment(int id)
        {
            try
            {
                var comment = commentManager.GetComment(id);
                if (comment != null && userSessionHelper.UserId == comment.Author.Id)
                {
                    await commentManager.Delete(id);

                    return(Request.CreateResponse(HttpStatusCode.OK, new
                    {
                        Status = "Success"
                    }));
                }
            }
            catch (Exception ex)
            {
                ErrorStore.LogException(ex, System.Web.HttpContext.Current);
            }
            return(Request.CreateResponse(HttpStatusCode.OK, new
            {
                Status = "Error"
            }));
        }
        public async Task <JsonResult> DeleteComment(int?id)
        {
            if (id != null)
            {
                Comment comment = await db.Comments.SingleOrDefaultAsync(x => x.Id == id);

                Ticket curTicket = await ticketManager.GetTicketNoInclude(comment.BaseTicketId);

                User curUser = await userManager.GetCurrentUser();

                TeamPermissions teamPerms = await GetCurrentTeamPermissions(comment.TeamId, curUser.Id);

                if (comment != null && teamPerms != null)
                {
                    if (comment.User.Id == curUser.Id || curUser.AppRole.Permissions.IsAdmin || teamPerms.CanDeleteComments)
                    {
                        bool result = await commentManager.Delete(id, curUser, curTicket);

                        return(Json(result, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
 public async Task <ApiResponse> Delete(long id)
 => await _commentManager.Delete(id);
 public void Delete(DeleteCommentInput input)
 {
     _commentManager.Delete(input.Id);
 }
Exemple #7
0
        public async Task <CommentDTO> Delete(long id, string loggedUserId)
        {
            var deleted = await commentManager.Delete(id, loggedUserId);

            return(mapper.Map <CommentDTO>(deleted));
        }