public async Task <bool> UpdateWebinarAsync(Guid webinarId, WebinarForUpdate webinarForUpdate) { var webinar = await FindWebinarById(webinarId); _mapper.Map(webinarForUpdate, webinar); return(await _dataContext.SaveChangesAsync() > 0); }
public async Task <Guid> AddWebinarAsync(Guid userId, WebinarForUpdate command) { var company = await _companyRepository.GetCompanyOrFailAsync(userId); var webinar = company.CompanyProfile.AddWebinar(command.Title, command.Description, command.WebinarUrl, command.StartDateOfTheEvent, command.EndDateOfTheEvent); if (!await _companyRepository.SaveAll()) { throw new Exception("Failed to add webinar"); } return(webinar.Id); }