コード例 #1
0
        public async Task <bool> Handle(UpdateAgentAutoresponderTemplateForRentInquiryCommand @command, CancellationToken cancellationToken)
        {
            var agent = await queryExecutor.Execute <GetAgentQuery, Agent>(new GetAgentQuery()
            {
                AgentId = @command.AggregateId
            });

            agent.RentInquiry.InquiryAutoresponderTemplate.AgentAutoresponderTemplateId    = @command.AgentAutoresponderTemplateForRentInquiryId;
            agent.RentInquiry.InquiryAutoresponderTemplate.CustomerAutoresponderTemplateId = @command.CustomerAutoresponderTemplateForRentInquiryId;

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

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

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

            return(true);
        }
コード例 #2
0
        public async Task <IActionResult> UpdateAgentAutoresponderTemplateForRentInquiry([FromBody] UpdateAgentAutoresponderTemplateForRentInquiryCommand @command)
        {
            var result = await mediator.Send(@command);

            return(result ?
                   (IActionResult)Ok(result) :
                   (IActionResult)BadRequest());
        }