public async Task ReorderAsync(ReorderTask model)
        {
            if (!Exists(model.Id, model.UserId))
            {
                throw new ValidationException("Unauthorized");
            }

            await _tasksRepository.ReorderAsync(model.Id, model.UserId, model.OldOrder, model.NewOrder, DateTime.UtcNow);
        }
예제 #2
0
        public async Task <IActionResult> Reorder([FromBody] ReorderTask dto)
        {
            if (dto == null)
            {
                return(BadRequest());
            }

            try
            {
                dto.UserId = IdentityHelper.GetUserId(User);
            }
            catch (UnauthorizedAccessException)
            {
                return(Unauthorized());
            }

            await _taskService.ReorderAsync(dto);

            return(NoContent());
        }