示例#1
0
        public IActionResult SoftDelete(int id)
        {
            UserProfile userProfile = GetCurrentUserProfile();
            var         userId      = userProfile.Id;

            _puzzleRepository.DeletePuzzle(id);
            History history = _historyRepository.GetHistoryByIds(userId, id);

            history.EndDateOwnership = DateTime.Now;
            _historyRepository.UpdateHistory(history);

            Request request = _requestRepository.GetRequestByPuzzleId(id);

            //if there is already a pending request for this puzzle, reject the request
            if (request != null)
            {
                _requestRepository.UpdateToReject(request);
            }
            return(NoContent());
        }