Esempio n. 1
0
        public async Task <ShopDto> CreateAsync(VisitorShopCreateOrEditDto input)
        {
            var newEntity = await _repository.InsertAsync(new Shop(GuidGenerator.Create(), input.Name, input.ShortName, input.LogoImage, input.Description, _currentTenant.Id)
            {
                CoverImage = input.CoverImage
            });

            return(ObjectMapper.Map <Shop, ShopDto>(newEntity));
        }
Esempio n. 2
0
        public async Task <ShopDto> UpdateAsync(Guid id, VisitorShopCreateOrEditDto body)
        {
            var find = await _repository.GetAsync(id);

            if (find == null)
            {
                throw new EntityNotFoundException(typeof(VisitorShopCreateOrEditDto), body.ShortName);
            }

            find.SetName(body.Name);
            find.SetShortName(body.ShortName);
            find.SetLogoImage(body.LogoImage);
            find.SetCoverImage(body.CoverImage);
            find.SetDescription(body.Description);

            return(ObjectMapper.Map <Shop, ShopDto>(find));
        }