Example #1
0
        public async Task <IActionResult> Report(ReportViewModel inputModel)
        {
            if (!ModelState.IsValid)
            {
                var result = this.View("Error", this.ModelState);
                result.StatusCode = (int)HttpStatusCode.BadRequest;
                return(result);
            }

            var currentUserId = this.userServices.GetUserId(User);
            await reportsService.AddReport(currentUserId, inputModel.PostId, inputModel.ReportReason);

            return(RedirectToAction("Index", "NewsFeed"));
        }