public static CreateAnimalCommand Create (AnimalPayload killAnimalRequest, HttpRequest httpRequest) { int.TryParse(httpRequest.GetAccountId(), out int accountId); // todo : test account for testing only, needs to be removed after all settled if (accountId == 0) { accountId = 137; } return(new CreateAnimalCommand(killAnimalRequest, httpRequest.GetRequestId1(), accountId, httpRequest.GetClientId())); }
public async Task <IActionResult> Post([FromBody] AnimalPayload payload) { // todo : enable async-preferred for animal-post queue if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var createAnimalResponse = await _mediator.Send(CreateAnimalCommand.Create(payload, Request)); var result = createAnimalResponse.ToRestResult(HttpStatusCode.Created); return(ObjectResultExtension.CreateResponse(result)); }
public static CreateAnimalCommand Create (AnimalPayload killAnimalRequest, CreateAnimalNotification notification) { return(new CreateAnimalCommand(killAnimalRequest, notification.RequestId, notification.AccountId, notification.ClientId)); }
public CreateAnimalCommand(AnimalPayload animalPayload, long?requestId, long accountId, string clientId) : base(requestId, accountId, clientId) { AnimalPayload = animalPayload; }