Skip to content

Instantly share code, notes, and snippets.

@brianhdk
Created March 30, 2020 13:32
Show Gist options
  • Select an option

  • Save brianhdk/2711745ab4c2fb68b84e489a991a066f to your computer and use it in GitHub Desktop.

Select an option

Save brianhdk/2711745ab4c2fb68b84e489a991a066f to your computer and use it in GitHub Desktop.
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