public ListOfTopics(ISectionsRepository sectionsRepo, ITopicsRepository topicsRepo, IMessagesRepository messagesRepo, int currentPage) { Sections = new List<Topics>(); TotalTopics = topicsRepo.Topics.Count(); int skip = (currentPage - 1) * TopicsPerPage; int current = 0; foreach (var section in sectionsRepo.Sections) { List<Theme> Themes = new List<Theme>(); foreach (var topic in topicsRepo.Topics.Where(t => t.SectionID == section.Id).ToList()) { if ((current >= skip) && (current < TopicsPerPage + skip)) Themes.Add(new Theme() { Posts = topic, TotalPosts = messagesRepo.Messages.Where(m => m.TopicId == topic.Id).Count(), UserId = messagesRepo.Messages.Where(m => (m.TopicId == topic.Id) && (m.IsFirstMessage == true)).FirstOrDefault().UserId }); current++; } if (Themes.Count() == 0) continue; Sections.Add(new Topics() { SectionId = section.Id, SectionTheme = section.Theme, Items = Themes }); if (current >= TopicsPerPage + skip) break; } CurrentPage = currentPage; }
public AddEditStudentViewModel(IStudentsRepository studentsRepository, ILevelsRepository levelsRepository, ISectionsRepository sectionsRepository, IContactsRepository contactsRepository, IRelBiometricsRepository relBiometricsRepository, IBiometricsRepository biometricsRepository, IRelOrganizationsRepository relOrganizationsRepository, IOrganizationsRepository organizationsRepository) { _studentsRepository = studentsRepository; _levelsRepository = levelsRepository; _sectionsRepository = sectionsRepository; _contactsRepository = contactsRepository; _relOrganizationsRepository = relOrganizationsRepository; _relBiometricsRepository = relBiometricsRepository; _biometricsRepository = biometricsRepository; _organizationsRepository = organizationsRepository; _enrollBiometricsViewModel = ContainerHelper.Container.Resolve <EnrollBiometricsViewModel>(); currentViewModel = _enrollBiometricsViewModel; CancelCommand = new RelayCommand(OnCancel); SaveCommand = new RelayCommand(OnSave, CanSave); OpenFileCommand = new RelayCommand(OnOpenFile); AddContactCommand = new RelayCommand(OnAddContact, CanAddContact); DeleteContactCommand = new RelayCommand <Contact>(OnDeleteContact); AddGroupCommand = new RelayCommand(OnAddGroup, CanAddGroup); DeleteGroupCommand = new RelayCommand <Organization>(OnDeleteGroup); DeleteBiometricCommand = new RelayCommand <Biometric>(OnDeleteBiometric); }
public TagType(ISectionsRepository sectionRepo) { Field(t => t.Id); Field(t => t.Name); Field <ListGraphType <SectionType>, List <Section> >() .Name("Sections") .ResolveAsync(context => sectionRepo.GetSectionsByTagIdAsync(context.Source.Id)); }
public DayType(ISectionsRepository sectionsRepo) { Field(d => d.Id); Field(d => d.AgendaDay); Field <ListGraphType <SectionType>, List <Section> >() .Name("Sections") .ResolveAsync(context => sectionsRepo.GetSectionsByDayIdAsync(context.Source.Id)); }
public ForumController(IMessagesRepository messages, IUsersRepository users, ISectionsRepository sections, ITopicsRepository topics) { this.messages = messages; this.users = users; this.sections = sections; this.topics = topics; }
public ForumData(DbContext context, IAnswersRepository answersRepository, ICommentsRepository commentsRepository, ISectionsRepository sectionsRepository, IThreadsRepository threadsRepository) { this.context = context; this.answersRepository = answersRepository; this.commentsRepository = commentsRepository; this.sectionsRepository = sectionsRepository; this.threadsRepository = threadsRepository; }
public SpeakerType(ISectionsRepository sectionsRepo) { Field(s => s.Id); Field(s => s.FirstName); Field(s => s.LastName); Field(s => s.Bio); Field(s => s.IsPanelist); Field(s => s.Title); Field <ListGraphType <SectionType>, List <Section> >() .Name("sections") .ResolveAsync(context => sectionsRepo.GetSectionsBySpeakerIdAsync(context.Source.Id)); //Field<GuidGraphType>("imageName", resolve: context => context.Source.ImageName); //Remember to mutate back to a guid type to store in the database. //Field(s => s.ImageName, type: typeof (StringGraphType)); }
public StudentViewModel(IStudentsRepository studentsRepository, ILevelsRepository levelsRepository, ISectionsRepository sectionsRepository, IContactsRepository contactsRepository, IRelBiometricsRepository relBiometricsRepository, IBiometricsRepository biometricsRepository) { AddCommand = new RelayCommand(OnAdd); DeleteCommand = new RelayCommand <Data.Student>(OnDelete); ClearCommand = new RelayCommand(OnClear); EditCommand = new RelayCommand <Data.Student>(OnEdit); _studentsRepository = studentsRepository; _contactsRepository = contactsRepository; _biometricsRepository = biometricsRepository; _relBiometricsRepository = relBiometricsRepository; _levelsRepository = levelsRepository; _sectionsRepository = sectionsRepository; Initialize(); }
public SectionViewModel(ILevelsRepository levelsRepository, ISectionsRepository sectionsRepository, IStudentsRepository studentsRepository) { _levelsRepository = levelsRepository; _sectionsRepository = sectionsRepository; _studentsRepository = studentsRepository; addEditSectionViewModel = ContainerHelper.Container.Resolve <AddEditSectionViewModel>(); EditCommand = new RelayCommand <Section>(OnEdit, CanEdit); AddCommand = new RelayCommand(OnAdd); DeleteCommand = new RelayCommand <Section>(OnDelete, CanDelete); AddRequested += NavToAddSection; EditRequested += NavToEditSection; addEditSectionViewModel.Done += NavToSection; Initialize(); }
public SectionsController(ISectionsRepository sectionsRepository, IMapper mapper) { _sectionsRepository = sectionsRepository; _mapper = mapper; }
public MITSMutation(IEventsRepository eventsRepo, IDaysRepository daysRepo, ITagsRepository tagRepo, ISectionsRepository sectionsRepo, ISpeakersRepository speakersRepo, IUserRepository userRepo, IWaRepository waRepo, IEventRegistrationBusinessLogic eventRegistrationBusinessLogic) { Name = "Mutation"; #region PrintBadge Field <PrintBadgeType, int>() .Name("printAttendeesBadge") //.AuthorizeWith("AdminPolicy") .Argument <NonNullGraphType <ListGraphType <PrintBadgeInputType> > >("printBadge", "Print Attendees Badge") .ResolveAsync(async context => { var registrationIds = context.GetArgument <PrintBadge>("printBadge"); return(12); //return await eventRegistrationBusinessLogic.CheckInAttendee(newCheckIn); }); #endregion #region Checkin Field <CheckInAttendeeType, CheckInAttendee>() .Name("checkInAttendee") .AuthorizeWith("CheckinPolicy") .Argument <NonNullGraphType <CheckInAttendeeInputType> >("checkInAttendee", "Check in event attendee") .ResolveAsync(async context => { var newCheckIn = context.GetArgument <CheckInAttendee>("checkInAttendee"); return(await eventRegistrationBusinessLogic.CheckInAttendee(newCheckIn)); }); #endregion #region Registration //mutation ProcessRegistration($registration: RegistrationInput!) { // processRegistration(registration: $registration) { // eventRegistrationId, // qrCode // } //} //{ // "registration" :{ // "dataDescriptor" : "COMMON.ACCEPT.INAPP.PAYMENT", // "dataValue" : "4354f34f34gfdhsfhfrhdfshs", // "firstName" : "Bob", // "lastName" :"Anderson", // "title" : "CEO, Boeing", // "email" : "*****@*****.**", // "memberId" :"121232", // "memberExpirationDate" : "0118", // "isLifeMember" : false, // "isLocal" : true, // "registrationTypeId" : 4574357, // "eventId" : 3176755 // } //} //Input, output Field <RegistrationType, Registration>() .Name("processRegistration") .Argument <NonNullGraphType <RegistrationInputType> >("registration", "Details to process a new registration") .ResolveAsync(async context => { var newRegistration = context.GetArgument <Registration>("registration"); return(await eventRegistrationBusinessLogic.RegisterAttendee(newRegistration)); //return new Registration() //{ // EventRegistrationId = 324234, // QrCode = "324j2o3kj423ijd23n23ij923jd923jd2938jd2398du2398du2398dj2398" //}; }); Field <SponsorType, Sponsor>() .Name("processSponsorRegistration") .Argument <NonNullGraphType <SponsorInputType> >("sponsor", "Details to process a new registration") .ResolveAsync(async context => { var newSponsorRegistration = context.GetArgument <Sponsor>("sponsor"); return(await eventRegistrationBusinessLogic.RegisterSponsor(newSponsorRegistration)); //return new Sponsor() //{ // EventRegistrationId = 324234, //}; }); #endregion #region Speaker Field <SpeakerType>( "createSpeaker", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <SpeakerInputType> > { Name = "speaker" } ), resolve: context => { try { var newSpeaker = context.GetArgument <Speaker>("speaker"); return(speakersRepo.CreateSpeakerAsync(newSpeaker)); } catch (Exception e) { Console.WriteLine(e); throw; } }).AuthorizeWith("AdminPolicy"); Field <SpeakerType>( "updateSpeaker", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <SpeakerInputType> > { Name = "speaker" } ), resolve: context => { try { var newSpeakerValues = context.GetArgument <Speaker>("speaker"); return(speakersRepo.UpdateSpeakerAsync(newSpeakerValues)); } catch (Exception e) { Console.WriteLine(e); throw; } }).AuthorizeWith("AdminPolicy");; Field <IntGraphType, int>() .Name("deleteSpeaker") .AuthorizeWith("AdminPolicy") .Argument <NonNullGraphType <IntGraphType> >("speakerId", "Id of Speaker to delete") .ResolveAsync(context => { try { return(speakersRepo.DeleteSpeakerAsync(context.GetArgument <int>("speakerId"))); } catch (Exception e) { Console.WriteLine(e); context.Errors.Add(new ExecutionError(e.Message)); return(null); } }); #endregion #region Event /* * mutation ($event: EventInput!) { * createEvent(event:$event){ * id * mainEventId * eventType * } * } * { * "event": { * "mainEventId" :"4334", * "eventRegistrationType" : "Main" * } * } */ Field <EventType, Event>() .Name("createEvent") .AuthorizeWith("AdminPolicy") .Argument <NonNullGraphType <EventInputType> >("event", "event input") .ResolveAsync(async context => { try { var newEvent = context.GetArgument <Event>("event"); //Is this the best place to put logic for other things..... what other choice do I have.... var eventAddedToDb = await eventsRepo.CreateEvent(newEvent); return(await waRepo.AddWildApricotEvent(eventAddedToDb)); ; } catch (Exception e) { Console.WriteLine(e); throw; } }); //Field<EventType>( // "createEvent", // arguments: new QueryArguments( // new QueryArgument<NonNullGraphType<EventInputType>> {Name = "event" } // ), // resolve: context => // { // try // { // var newEvent = context.GetArgument<Event>("event"); // //Is this the best place to put logic for other things..... what other choice do I have.... // await waRepo.AddWildApricotEvent(newEvent); // return eventsRepo.CreateEvent(newEvent); // } // catch (Exception e) // { // Console.WriteLine(e); // throw; // } // }); #endregion #region Day /* * Create Day * mutation ($day: DayInput!) { * createEvent(day:$day){ * id * agendaDay * } * } * * { * "day": { * "agendaDay" : "2018-10-09" * } * } */ Field <DayType, Day>() .Name("createDay") .AuthorizeWith("AdminPolicy") .Argument <NonNullGraphType <DayInputType> >("day", "day input") .ResolveAsync(context => { try { var newDay = context.GetArgument <Day>("day"); return(daysRepo.CreateDayAsync(newDay)); } catch (Exception e) { Console.WriteLine(e); throw; } }); /*deleteDay * mutation ($dayId: Int!) { * deleteDay(dayId:$dayId){ * id * agendaDay * } *} * * { * "dayId" : "3" * } */ Field <IntGraphType, List <Day> >() .Name("deleteDay") .AuthorizeWith("AdminPolicy") .Argument <NonNullGraphType <IntGraphType> >("dayId", "Id of Day to delete") .ResolveAsync(context => { try { return(daysRepo.DeleteDayAsync(context.GetArgument <int>("dayId"))); } catch (Exception e) { Console.WriteLine(e); context.Errors.Add(new ExecutionError(e.Message)); return(null); } }); #endregion }
public SectionsService(ISectionsRepository sectionsRepository, IUnitOfWork unitOfWork) { this.sectionsRepository = sectionsRepository; this.unitOfWork = unitOfWork; }
public CategoriesController(ICategoriesRepository categoriesRepository, ISectionsRepository sectionsRepository, IMapper mapper) { _categoriesRepository = categoriesRepository; _sectionsRepository = sectionsRepository; _mapper = mapper; }
public MITSQuery(IEventsRepository eventsRepo, IDaysRepository daysRepo, ISpeakersRepository speakerRepo, ITagsRepository tagRepo, IUserRepository userRepo, ISectionsRepository sectionsRepo) { Name = "query"; #region Event Field <EventType>( "event", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => eventsRepo.GetEventByIdAsync(context.GetArgument <int>("id")) ); //this.AuthorizeWith("AdminPolicy"); Field <ListGraphType <EventType> >( "events", resolve: context => eventsRepo.GetEventsAsync() ) //.AuthorizeWith("AdminPolicy") ; #endregion #region Day //Field<ListGraphType<DayType>>( // "days", // resolve: context => daysRepo.GetDays() // ); Field <ListGraphType <DayType>, List <Day> >() .Name("days") .ResolveAsync(context => daysRepo.GetDaysAsync()); #endregion #region Section Field <ListGraphType <SectionType>, List <Section> >() .Name("sections") .ResolveAsync(context => sectionsRepo.GetSectionsAsync()); #endregion #region Speaker Field <ListGraphType <SpeakerType>, List <Speaker> >() .Name("speakers") .ResolveAsync(context => speakerRepo.GetSpeakersAsync()); Field <SpeakerType, Speaker>() .Name("speaker") .Argument <NonNullGraphType <IntGraphType> >("speakerId", "Id of speaker to get") .ResolveAsync(context => speakerRepo.GetSpeakerByIdAsync(context.GetArgument <int>("speakerId"))); #endregion #region Tag Field <ListGraphType <TagType>, List <Tag> >() .Name("tags") .ResolveAsync(context => tagRepo.GetTagsAsync()); #endregion #region User Field <ListGraphType <UserType>, List <User> >() .Name("users") .AuthorizeWith("AdminPolicy") .ResolveAsync(context => userRepo.GetUsersAsync()); #endregion }
public SectionListViewComponent(ISectionsRepository repository) { _repository = repository; }