Ejemplo n.º 1
0
        public async Task <IActionResult> ChangeShippingAddress(Guid id, [FromBody] ChangeShippingAddressModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await WorkerServices.ChangeShippingAddressAsync(id, model);

            return(Ok());
        }
Ejemplo n.º 2
0
        public async Task ChangeShippingAddressAsync(Guid personId, ChangeShippingAddressModel 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 ChangePersonShippingAddressCommand(
                userId,
                personId,
                model.Address.Address,
                model.Address.PostalCode,
                model.Address.City,
                model.Address.Province,
                model.Address.Country,
                effectiveDate);

            await Bus.Send(cmd);
        }