Example #1
0
        public async Task <SpeakerDetailModel> GetSpeakerByIdAsync(int IdSpeaker)
        {
            SpeakerDetailModel speaker = await DbContext.Speaker.Select(
                s => new SpeakerDetailModel
            {
                IdSpeaker      = s.IdSpeaker,
                FirstName      = s.FirstName,
                SecondName     = s.SecondName,
                FirstLastName  = s.FirstLastName,
                SecondLastName = s.SecondLastName,
                TwitterLink    = s.TwitterLink,
                LinkedInLink   = s.LinkedInLink,
                PhotoLink      = s.PhotoLink
            })
                                         .FirstOrDefaultAsync(s => s.IdSpeaker == IdSpeaker);

            speaker.Sessions = await DbContext.SpeakerHasSession.Select(
                s => new SpeakerHasSessionModel
            {
                IdSpeaker      = s.IdSpeaker,
                FirstName      = s.IdSpeakerNavigation.FirstName,
                SecondName     = s.IdSpeakerNavigation.SecondName,
                FirstLastName  = s.IdSpeakerNavigation.FirstLastName,
                SecondLastName = s.IdSpeakerNavigation.SecondLastName,

                IdSession        = s.IdSession,
                Name             = s.IdSessionNavigation.Name,
                StartDate        = s.IdSessionNavigation.StartDate,
                NameSessionLevel = s.IdSessionNavigation.IdSessionLevelNavigation.Name,
                NameSessionType  = s.IdSessionNavigation.IdSessionTypeNavigation.Name
            }
                ).Where(s => s.IdSpeaker == IdSpeaker).ToListAsync();

            return(speaker);
        }
Example #2
0
        public override async Task PreRender()
        {
            int id = Convert.ToInt32(Context.Parameters["IdSpeaker"]);

            Speaker = await SpeakerService.GetSpeakerByIdAsync(id);

            await base.PreRender();
        }
Example #3
0
        public SpeakerDetail(SpeakerDetailModel speaker)
        {
            InitializeComponent();

            Speaker = speaker;

            lblSpeaker.Text = speaker.FirstName + ' ' +
                              speaker.LastName;
            lblGravatarUrl.Text     = speaker.GravatarUrl;
            lblTwitterLink.Text     = speaker.TwitterLink;
            lblGitHubLink.Text      = speaker.GitHubLink;
            lblLinkedInProfile.Text = speaker.LinkedInProfile;
            lblBiography.Text       = speaker.Biography;
        }
Example #4
0
        public async Task UpdateSpeakerAsync(SpeakerDetailModel Speaker)
        {
            var entity = await DbContext.Speaker.FirstOrDefaultAsync(s => s.IdSpeaker == Speaker.IdSpeaker);

            entity.FirstName      = Speaker.FirstName;
            entity.SecondName     = Speaker.SecondName;
            entity.FirstLastName  = Speaker.FirstLastName;
            entity.SecondLastName = Speaker.SecondLastName;
            entity.TwitterLink    = Speaker.TwitterLink;
            entity.LinkedInLink   = Speaker.LinkedInLink;
            entity.PhotoLink      = Speaker.PhotoLink;

            await DbContext.SaveChangesAsync();
        }
Example #5
0
        public async Task InsertSpeakerAsync(SpeakerDetailModel Speaker)
        {
            var entity = new Speaker()
            {
                FirstName      = Speaker.FirstName,
                SecondName     = Speaker.SecondName,
                FirstLastName  = Speaker.FirstLastName,
                SecondLastName = Speaker.SecondLastName,
                TwitterLink    = Speaker.TwitterLink,
                LinkedInLink   = Speaker.LinkedInLink,
                PhotoLink      = Speaker.PhotoLink,
                IdEvent        = EventId.GetInstance().Id
            };

            DbContext.Speaker.Add(entity);
            await DbContext.SaveChangesAsync();
        }