示例#1
0
        private async Task <Product> MapAsync(Product product, ProductCategory category,
                                              Data.Entity.Models.Tenant tenant,
                                              ProductModel model)
        {
            product.Name       = model.Name;
            product.CategoryId = category.Id;
            product.Price      = new Price {
                Amount = model.Price !.Value
            };
            product.Description = model.Description;
            product.IsAvailable = model.IsAvailable !.Value;

            await UpdateImageAsync(product, model);

            product.Page ??= new Page
            {
                CompanyId        = tenant.CompanyId,
                TenantId         = tenant.Id,
                Slug             = _slugService.GetSlug(product.Name),
                CreationDateTime = DateTime.UtcNow
            };

            product.Variations = model.Variations?.Select(item =>
                                                          new Variation
            {
                Id    = item.Id ?? default,
                Price = new Price
                {
                    Amount = item.Price !.Value
                },
 public TenantListResult(Data.Entity.Models.Tenant tenant)
 {
     Slug         = tenant.Slug;
     Name         = tenant.Name;
     Logo         = tenant.Logo?.Url;
     Tags         = tenant.Tags;
     DeliveryTime = tenant.DeliveryTime;
     DeliveryFee  = tenant.DeliveryFee;
     Description  = tenant.Description;
     IsActive     = tenant.IsActive;
 }
示例#3
0
        public TenantResult(Data.Entity.Models.Tenant tenant)
        {
            Slug = tenant.Slug;
            Name = tenant.Name;
            Logo = tenant.Logo?.Url;

            if (tenant.Tags != null)
            {
                Tags.AddRange(tenant.Tags.Split(','));
            }

            DeliveryTime = tenant.DeliveryTime;
            DeliveryFee  = tenant.DeliveryFee;
        }
示例#4
0
 public TenantResult(Data.Entity.Models.Tenant tenant)
 {
     Slug               = tenant.Slug;
     Name               = tenant.Name;
     LogoUrl            = tenant.Logo?.Url;
     Tags               = tenant.Tags;
     DeliveryTime       = tenant.DeliveryTime;
     DeliveryFee        = tenant.DeliveryFee;
     Description        = tenant.Description;
     PaymentMethodTypes = tenant.PaymentMethodType.ToList();
     NotificationTypes  = tenant.NotificationType.ToList();
     BusinessHours      = tenant.BusinessHours?.Select(item => new BusinessHourResult(item))?.ToList();
     IsActive           = tenant.IsActive;
     Address            = new AddressResult(tenant.Address);
     PhoneNumber        = tenant.PhoneNumber;
     FacebookUrl        = tenant.FacebookUrl;
     WhatsAppNumber     = tenant.WhatsAppNumber;
 }
示例#5
0
        private ProductCategory Map(ProductCategory category, ProductCategoryModel model, Data.Entity.Models.Tenant tenant)
        {
            category.Description = model.Description;
            category.Name        = model.Name;
            category.TenantId    = tenant.Id;

            if (model.ImageUrl != null)
            {
                category.Image = new CategoryImage
                {
                    Url = model.ImageUrl
                };
            }

            return(category);
        }
示例#6
0
 public Task <List <User> > ListAsync(Data.Entity.Models.Tenant tenant)
 {
     return(_dbContext.Users
            .Where(item => item.TenantId == tenant.Id)
            .ToListAsync());
 }