示例#1
0
        public static BrandCreateDtoModel Map(BrandCreateInputModel brandCreateInputModel)
        {
            var brandDtoModel = new BrandCreateDtoModel()
            {
                Name         = brandCreateInputModel.Name.ToUpper(),
                ImageAddress = brandCreateInputModel.ImageAddress,
            };

            return(brandDtoModel);
        }
        public static Brand Map(BrandCreateDtoModel brandCreateDtoModel)
        {
            var brand = new Brand
            {
                Name         = brandCreateDtoModel.Name,
                ImageAddress = brandCreateDtoModel.ImageAddress,
            };

            return(brand);
        }
示例#3
0
        public async Task CreateBrand(BrandCreateDtoModel brandCreateDtoModel)
        {
            if (brandCreateDtoModel.ImageAddress == null)
            {
                brandCreateDtoModel.ImageAddress = GlobalConstants.ImageAddress;
            }

            var brand = BrandServiceCreateMapper.Map(brandCreateDtoModel);

            await this.brands.AddAsync(brand);

            await this.brands.SaveChangesAsync();
        }