Exemplo n.º 1
0
        public EventPlanningModel Get(int id)
        {
            var result = new EventPlanningModel();

            using (var db = new DataContext())
            {
                var conf = db.CallsForSpeakers.Include(x => x.Organizer)
                    .SingleOrDefault(x => x.Id == id);

                if (conf == null)
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
                }

                result.EventName = conf.EventName;
                result.EventDescription = conf.Description;
                result.EventLogoUrl = conf.LogoUrl;

                result.OrganizerName = conf.Organizer.Name;
                result.OrganizerEmail = conf.Organizer.Email;

                result.FirstDay = conf.FirstDayOfEvent;
                result.LastDay = conf.LastDayOfEvent;
                result.LastDayToSubmit = conf.LastDayToSubmit;

                var acceptedSessions = db.Submissions
                    .Where(s => s.CallForSpeakers.Id == id && s.Status == Submission.Accepted).ToArray();

                result.AcceptedSubmissions = acceptedSessions.Select(x => new AcceptedSubmissions
                {
                    Abstract = x.Abstract,
                    Title = x.Title,
                    SpeakerEmail = x.SpeakerEmail,
                    SpeakerName = x.SpeakerName,
                    SpeakerPhotoUrl = x.SpeakerImageUrl,
                    SpeakerTwitter = x.SpeakerTwitter,
                    SpeakerBio = x.SpeakerBio,
                    SpeakerPhone = x.SpeakerPhone
                });
            }

            return result;
        }
Exemplo n.º 2
0
        public EventPlanningModel Get(int id)
        {
            var result = new EventPlanningModel();

            using (var db = new DataContext())
            {
                var conf = db.CallsForSpeakers.Include(x => x.Organizer)
                           .SingleOrDefault(x => x.Id == id);

                if (conf == null)
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
                }

                result.EventName        = conf.EventName;
                result.EventDescription = conf.Description;
                result.EventLogoUrl     = conf.LogoUrl;

                result.OrganizerName  = conf.Organizer.Name;
                result.OrganizerEmail = conf.Organizer.Email;

                result.FirstDay        = conf.FirstDayOfEvent;
                result.LastDay         = conf.LastDayOfEvent;
                result.LastDayToSubmit = conf.LastDayToSubmit;

                var acceptedSessions = db.Submissions
                                       .Where(s => s.CallForSpeakers.Id == id && s.Status == Submission.Accepted).ToArray();

                result.AcceptedSubmissions = acceptedSessions.Select(x => new AcceptedSubmissions
                {
                    Abstract        = x.Abstract,
                    Title           = x.Title,
                    SpeakerEmail    = x.SpeakerEmail,
                    SpeakerName     = x.SpeakerName,
                    SpeakerPhotoUrl = x.SpeakerImageUrl,
                    SpeakerTwitter  = x.SpeakerTwitter,
                    SpeakerBio      = x.SpeakerBio,
                    SpeakerPhone    = x.SpeakerPhone
                });
            }

            return(result);
        }