public Dictionary <int, int> GetServicesIdForDate(DateTime date) { Dictionary <int, int> serviceDict = new Dictionary <int, int>(); var events = repository.Query(x => x.EventDate == date).ToList(); foreach (var eventItem in events) { var eventServices = eventServiceService.GetByEventId(eventItem.Id); foreach (var eventService in eventServices) { int currentCount; serviceDict.TryGetValue(eventService.ServiceId, out currentCount); serviceDict[eventService.ServiceId] = currentCount + 1; } } return(serviceDict); }
public List <EventWrapper> GetEventWrappersByUserId(int id) { if (id < 1) { throw new ArgumentNullException(nameof(ServiceDto)); } var events = eventService.GetByUserId(id); var eventWrapperList = new List <EventWrapper>(); foreach (var eventItem in events) { var eventWrapper = new EventWrapper(); eventWrapper.EventId = eventItem.Id; eventWrapper.EventDate = eventItem.EventDate; eventWrapper.EventType = eventItem.EventType; eventWrapper.EventStatus = eventItem.Status; eventWrapper.ServiceWrappers = new List <ServiceWrapper>(); var eventServices = eventServiceService.GetByEventId(eventItem.Id); foreach (var eventService in eventServices) { var serviceWrapper = GetServiceWrapperByServiceIdAndServicePackageId(eventService.ServiceId, eventService.ServicePackageId); serviceWrapper.Status = eventService.Status; serviceWrapper.EventServiceId = eventService.Id; serviceWrapper.User = userService.GetById(serviceWrapper.Service.UserId); serviceWrapper.ProfilePictureUri = GetProfilePictureUri(serviceWrapper.Service.UserId).Result; eventWrapper.ServiceWrappers.Add(serviceWrapper); } eventWrapperList.Add(eventWrapper); } return(eventWrapperList.OrderByDescending(x => x.EventDate).ToList()); }