예제 #1
0
        public async Task <IActionResult> ReportComment([FromBody] GanjoorPostReportCommentViewModel report)
        {
            Guid userId =
                new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
            Guid sessionId =
                new Guid(User.Claims.FirstOrDefault(c => c.Type == "SessionId").Value);
            RServiceResult <bool> sessionCheckResult = await _appUserService.SessionExists(userId, sessionId);

            if (!string.IsNullOrEmpty(sessionCheckResult.ExceptionString))
            {
                return(StatusCode((int)HttpStatusCode.Forbidden));
            }

            RServiceResult <int> res = await _ganjoorService.ReportComment(userId, report);

            if (!string.IsNullOrEmpty(res.ExceptionString))
            {
                return(BadRequest(res.ExceptionString));
            }
            return(Ok(res.Result));
        }
예제 #2
0
        public void OnGet()
        {
            PostSuccess = false;
            LastError   = "";
            LoggedIn    = !string.IsNullOrEmpty(Request.Cookies["Token"]);

            Report = new GanjoorPostReportCommentViewModel()
            {
                ReasonCode = "bogus",
                ReasonText = "",
            };

            if (!string.IsNullOrEmpty(Request.Query["CommentId"]))
            {
                Report.CommentId = int.Parse(Request.Query["CommentId"]);
            }
            else
            {
                Report.CommentId = 0;
            }
        }