コード例 #1
0
        public async Task <IActionResult> UpdateAgentMortgageSpreadsheetCommand([FromBody] UpdateAgentMortgageSpreadsheetCommand @command)
        {
            var result = await mediator.Send(@command);

            return(result ?
                   (IActionResult)Ok(result) :
                   (IActionResult)BadRequest());
        }
コード例 #2
0
        public async Task <bool> Handle(UpdateAgentMortgageSpreadsheetCommand @command, CancellationToken cancellationToken)
        {
            var agent = await queryExecutor.Execute <GetAgentQuery, Agent>(new GetAgentQuery()
            {
                AgentId = @command.AggregateId
            });

            agent.AgentSpreadsheet.UpdateMortgageSpreadsheet(@command.SpreadsheetId, @command.SpreadsheetName, @command.SpreadsheetUrl, @command.SpreadsheetShareableUrl);

            var filter = Builders <Agent> .Filter.Eq("Id", agent.Id);

            var update = Builders <Agent> .Update
                         .Set("AgentSpreadsheet", agent.AgentSpreadsheet)
                         .CurrentDate("UpdatedDate");

            await agentRepository.Collection
            .UpdateOneAsync(filter, update, new UpdateOptions { IsUpsert = true });

            return(true);
        }