コード例 #1
0
 public IActionResult Delete(string categoryAlias, TPrimaryKey threadId, ThreadEditViewModel threadEditViewModel)
 {
     throw new NotImplementedException();
 }
コード例 #2
0
        public async Task <IActionResult> Edit(string categoryAlias, TPrimaryKey threadId, ThreadEditViewModel threadEditViewModel)
        {
            var threadDto = await _threadService.GetAsync(threadId);

            _mapper.Map(threadEditViewModel, threadDto);
            var isCurrentUserCategoryModerator = await _categoryToModeratorService
                                                 .IsUserCategoryModeratorAsync(threadDto.CategoryId, User);

            if (isCurrentUserCategoryModerator)
            {
                await _threadService.EditAsync(threadDto);

                return(RedirectToAction("Details", "Threads", new { categoryAlias = categoryAlias, threadId = threadDto.Id }));
            }
            else
            {
                throw new HttpResponseException(HttpStatusCode.Forbidden, $"Access denied");
            }
        }