Beispiel #1
0
        public async Task ShouldUpdate_FinancierAddress_Using_UpdateFinancierAddressInfoCommand()
        {
            Financier financier = await _dbContext.Financiers.FindAsync(new Guid("12998229-7ede-4834-825a-0c55bde75695"));

            var model = new EditFinancierAddressInfo
            {
                AddressId    = 10,
                FinancierId  = financier.Id,
                AddressLine1 = "32145 Main Street",
                AddressLine2 = "3rd Floor",
                City         = "Oxnard",
                StateCode    = "CA",
                Zipcode      = "93035"
            };

            await _financierCmdHdlr.Handle(model);

            var address = (from item in financier.Addresses()
                           where item.AddressDetails.AddressLine1.Equals(model.AddressLine1) &&
                           item.AddressDetails.AddressLine2.Equals(model.AddressLine2) &&
                           item.AddressDetails.City.Equals(model.City) &&
                           item.AddressDetails.StateCode.Equals(model.StateCode) &&
                           item.AddressDetails.Zipcode.Equals(model.Zipcode)
                           select item).SingleOrDefault();

            Assert.NotNull(address);
        }
        public async Task <IActionResult> EditFinancierAddressInfo([FromBody] EditFinancierAddressInfo writeModel)
        {
            try
            {
                await _commandHandler.Handle(writeModel);

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(new BadRequestObjectResult(ex.Message));
            }
        }