Created
March 30, 2020 13:32
-
-
Save brianhdk/2711745ab4c2fb68b84e489a991a066f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (request == null) | |
| return new BadRequestErrorMessageResult("Request is empty."); | |
| if (string.IsNullOrWhiteSpace(request.Id)) | |
| return new BadRequestErrorMessageResult($"Missing required value for property '{nameof(ReindeerRescueRequest.Id)}'."); | |
| if (!Guid.TryParse(request.Id, out Guid id)) | |
| return new BadRequestErrorMessageResult($"Value for property '{nameof(ReindeerRescueRequest.Id)}' is not a valid ID or has an invalid format (example of valid value and format for Unique Identifier (GUID): '135996C9-3090-4399-85DB-1F5041DF1DDD')."); | |
| Attempt attempt = await _attemptService.Get(id, expectedVersion: 2, token); | |
| if (attempt == null) | |
| return new NotFoundResult(); | |
| if (!attempt.SantaRescueAt.HasValue) | |
| return new BadRequestErrorMessageResult($"It looks like you're reusing an old ID from a previous failed attempt created {attempt.Created} - you need to start all over again - remember not to hard code any IDs in your application."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment