示例#1
0
            public async Task <List <ShippingMethodListViewModel> > Handle(ShippingMethodListQuery request, CancellationToken cancellationToken)
            {
                var tenantId = this._userIdentityService.GetTenantId();
                var entities = await this._repository.Find(c => c.EntityStatus != Domain.Entities.EntityStatus.Deleted);

                var result = this._mapper.Map <List <ShippingMethodListViewModel> >(entities);

                var shippingMethodAvailables = await this._shippingMethodTenantRepository.GetShippingMethods(tenantId);

                foreach (var item in result)
                {
                    if (shippingMethodAvailables != null && shippingMethodAvailables.Any(x => x.ShippingMethodId.Equals(item.ShippingMethodId)))
                    {
                        item.Enabled = true;
                    }
                }

                return(result);
            }
        public async Task <IActionResult> Get([FromQuery] ShippingMethodListQuery query)
        {
            var model = await this._mediator.Send(query);

            return(this.Ok(model));
        }