public void Fire(string eventName) { var userEvent = UserEvents.SingleOrDefault(e => e.Name == eventName); if (userEvent == null) { userEvent = new UserEvent { Name = eventName }; userEvent.Occurrrences.Add(DateTime.Now); UserEvents.Add(userEvent); } else { userEvent.Occurrrences.Add(DateTime.Now); } }
public void AddUserEvent(int eventType, System.Security.Claims.ClaimsPrincipal user, string searchText = "", string searchResults = "", int movieID = 0) { if (eventType == 0) { UserEvents.Add(new UserEvent { UserName = user.FindFirst(System.Security.Claims.ClaimTypes.Name).Value, SearchTerms = searchText, SearchResult = searchResults, EventDate = System.DateTime.Now }); } if (eventType == 1) { UserEvents.Add(new UserEvent { UserName = user.FindFirst(System.Security.Claims.ClaimTypes.Name).Value, MovieRental = movieID, EventDate = System.DateTime.Now }); } SaveChanges(); }
protected void AddEvent(UserEventType userEventType) { UserEvents.Add(new UserEvent(this, userEventType)); }