public async Task CreateServiceRelationAsync(ProviderServiceRelationViewModel viewModel)
        {
            var dataModel = _mapper.Map <ServiceProviderService>(viewModel);

            if (viewModel.Photo != null)
            {
                dataModel.PhotoId = await _photoManager.AddAsync(viewModel.Photo);
            }
            context.ServiceProviderServices.Add(dataModel);
            await context.SaveChangesAsync();
        }
예제 #2
0
        public async Task AddAsync(ServiceViewModelCreate viewModel, bool isApproved)
        {
            var dataModel = _mapper.Map <Service>(viewModel);

            if (viewModel.Photo != null)
            {
                dataModel.PhotoId = await _photoManager.AddAsync(viewModel.Photo);
            }
            dataModel.IsApproved = isApproved;
            context.Services.Add(dataModel);
            await context.SaveChangesAsync();
        }