Example #1
0
        public async Task <IActionResult> ChangeLegalAddress(Guid id, [FromBody] ChangeLegalAddressModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await WorkerServices.ChangeLegalAddressAsync(id, model);

            return(Ok());
        }
Example #2
0
        public async Task ChangeLegalAddressAsync(Guid personId, ChangeLegalAddressModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var userId = GetCurrentUserId();

            var effectiveDateTime = model.EffectiveDate;
            var effectiveDate     = new DateTime(effectiveDateTime.Year, effectiveDateTime.Month, effectiveDateTime.Day);

            var cmd = new ChangePersonLegalAddressCommand(
                userId,
                personId,
                model.Address.Address,
                model.Address.PostalCode,
                model.Address.City,
                model.Address.Province,
                model.Address.Country,
                effectiveDate);

            await Bus.Send(cmd);
        }