public async Task <CommitmentView> PostCommitment(string url, CommitmentRequest commitment) { var data = JsonConvert.SerializeObject(commitment); var content = await PostAsync(url, data); return(JsonConvert.DeserializeObject <CommitmentView>(content)); }
public async Task <IHttpActionResult> CreateCommitment(long accountId, CommitmentRequest commitment) { var response = await _employerOrchestrator.CreateCommitment(accountId, commitment); return(CreatedAtRoute("GetCommitmentForEmployer", new { accountId, commitmentId = response }, new CommitmentView { Id = response })); }
public async Task <CreateCommitmentCommandResponse> Handle(CreateCommitmentCommand request) { // TODO: This needs to return just the Id var commitmentRequest = new CommitmentRequest { Commitment = request.Commitment, UserId = request.UserId, Message = request.Message }; var commitmentId = (await _commitmentApi.CreateEmployerCommitment(request.Commitment.EmployerAccountId, commitmentRequest)).Id; var commitment = await _commitmentApi.GetEmployerCommitment(request.Commitment.EmployerAccountId, commitmentId); if (request.Commitment.CommitmentStatus == CommitmentStatus.Active) { await SendNotification(commitment); } return(new CreateCommitmentCommandResponse { CommitmentId = commitment.Id }); }
public async Task <CommitmentView> CreateEmployerCommitment(long employerAccountId, CommitmentRequest commitment) { var url = $"{_configuration.BaseUrl}api/employer/{employerAccountId}/commitments"; return(await _commitmentHelper.PostCommitment(url, commitment)); }
public async Task <CommitmentView> CreateProviderCommitment(long providerId, CommitmentRequest commitment) { var url = $"{_configuration.BaseUrl}api/provider/{providerId}/commitments"; return(await _commitmentHelper.PostCommitment(url, commitment)); }
public IHttpActionResult CreateCommitment(long providerId, CommitmentRequest commitment) { throw new InvalidOperationException(); }