public async Task <bool> UpdateWebinar(Webinars webinar) { try { var modelToBeUpdated = _context.Webinars.FirstOrDefaultAsync(webinarDetail => webinarDetail.Id == webinar.Id).Result; modelToBeUpdated.WebinarName = webinar.WebinarName; modelToBeUpdated.CategoryId = webinar.CategoryId; modelToBeUpdated.IsFeatured = webinar.IsFeatured; modelToBeUpdated.WebinarTypeId = webinar.WebinarTypeId; modelToBeUpdated.Duration = webinar.Duration; modelToBeUpdated.Overview = webinar.Overview; modelToBeUpdated.LearningObjectives = webinar.LearningObjectives; modelToBeUpdated.ReasonToAttend = webinar.ReasonToAttend; modelToBeUpdated.AreasCovered = webinar.AreasCovered; modelToBeUpdated.WhoWillBenefit = webinar.WhoWillBenefit; modelToBeUpdated.FacultyId = webinar.FacultyId; modelToBeUpdated.DateAndTime = webinar.DateAndTime; modelToBeUpdated.ThumbImageUrl = webinar.ThumbImageUrl; modelToBeUpdated.FacultyLocalId = _context.Faculties.FirstOrDefaultAsync(faculty => faculty.Id == webinar.FacultyId).Result.LocalId; _context.Entry(modelToBeUpdated).State = EntityState.Modified; var response = await _context.SaveChangesAsync(); return(response >= 1); } catch (DbUpdateException ex) { throw ex; } }
public Webinars GetWebinarsUserCartAndOrderItems(Webinars webinar, string userId) { if (userId != null) { webinar.CartItems = webinar.CartItems.Where(cartItem => cartItem.Cart.UserId == new Guid(userId)).ToList(); webinar.OrderItems = webinar.OrderItems.Where(orderItem => orderItem.Order.UserId == new Guid(userId)).ToList(); } return(webinar); }
public async Task <bool> AddWebinar(Webinars webinar) { try { webinar.FacultyLocalId = _context.Faculties.FirstOrDefaultAsync(faculty => faculty.Id == webinar.FacultyId).Result.LocalId; _context.Webinars.Add(webinar); var response = await _context.SaveChangesAsync(); return(response >= 1); } catch (DbUpdateException ex) { throw new DbUpdateException(ex.Message); } }
private ZoomClient(IConnectionInfo connectionInfo, HttpClient httpClient, bool disposeClient, ZoomClientOptions options, ILogger logger = null) { _mustDisposeHttpClient = disposeClient; _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); _options = options ?? GetDefaultOptions(); _logger = logger ?? NullLogger.Instance; _fluentClient = new FluentClient(new Uri(ZOOM_V2_BASE_URI), httpClient) .SetUserAgent($"ZoomNet/{Version} (+https://github.com/Jericho/ZoomNet)"); _fluentClient.Filters.Remove <DefaultErrorFilter>(); // Order is important: the token handler (either JWT or OAuth) must be first, followed by DiagnosticHandler and then by ErrorHandler. if (connectionInfo is JwtConnectionInfo jwtConnectionInfo) { var tokenHandler = new JwtTokenHandler(jwtConnectionInfo); _fluentClient.Filters.Add(tokenHandler); _fluentClient.SetRequestCoordinator(new ZoomRetryCoordinator(new Http429RetryStrategy(), tokenHandler)); } else if (connectionInfo is OAuthConnectionInfo oauthConnectionInfo) { var tokenHandler = new OAuthTokenHandler(oauthConnectionInfo, httpClient); _fluentClient.Filters.Add(tokenHandler); _fluentClient.SetRequestCoordinator(new ZoomRetryCoordinator(new Http429RetryStrategy(), tokenHandler)); } else { throw new ZoomException($"{connectionInfo.GetType()} is an unknown connection type", null, null, null, null); } // The list of filters must be kept in sync with the filters in Utils.GetFluentClient in the unit testing project. _fluentClient.Filters.Add(new DiagnosticHandler(_options.LogLevelSuccessfulCalls, _options.LogLevelFailedCalls, _logger)); _fluentClient.Filters.Add(new ZoomErrorHandler()); Accounts = new Accounts(_fluentClient); Chat = new Chat(_fluentClient); CloudRecordings = new CloudRecordings(_fluentClient); Contacts = new Contacts(_fluentClient); DataCompliance = new DataCompliance(_fluentClient); Meetings = new Meetings(_fluentClient); PastMeetings = new PastMeetings(_fluentClient); PastWebinars = new PastWebinars(_fluentClient); Users = new Users(_fluentClient); Webinars = new Webinars(_fluentClient); Dashboards = new Dashboards(_fluentClient); }