Exemple #1
0
        public async Task <StudioDto> CreateAsync(StudioDto model)
        {
            var newEntity = Studio.Create(
                model.Name,
                model.FriendlyUrl,
                model.PostalCode,
                model.OwnerUserId,
                _studioUrlValidator);

            var entity = await _studioRepository.CreateAsync(newEntity);

            var result = _mapper.Map <StudioDto>(entity);

            return(result);
        }
Exemple #2
0
        public async Task <StudioDto> UpdateAsync(StudioDto model)
        {
            var studio = await _studioRepository.GetAsync(model.Id);

            if (studio == null)
            {
                return(null);
            }

            studio.Update(model.Name, model.FriendlyUrl, model.PostalCode, _studioUrlValidator);
            var entity = await _studioRepository.UpdateAsync(studio);

            var result = _mapper.Map <StudioDto>(entity);

            return(result);
        }