Exemplo n.º 1
0
        /// <summary>
        /// Maps a CodeCampService.Speaker to a Model.Speaker
        /// </summary>
        /// <param name="speaker">CodeCampService.Speaker</param>
        /// <returns>Model.Speaker</returns>
        public static Model.Speaker Map(Services.Speaker speaker)
        {
            var modelSpeaker = new Model.Speaker()
            {
                ImageUrl      = speaker.ImageUrl,
                Website       = speaker.Website,
                Email         = speaker.Email,
                Bio           = speaker.Bio,
                Twitter       = speaker.Twitter,
                Blog          = speaker.Blog,
                Title         = speaker.Title,
                FirstName     = speaker.FirstName,
                LastName      = speaker.LastName,
                IsAdmin       = speaker.IsAdmin,
                LoginProvider = speaker.LoginProvider
            };

            modelSpeaker.Sessions = (List <Model.Session>)speaker.Sessions.Map();
            return(modelSpeaker);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Maps a CodeCampService.Speaker to a Model.Speaker
        /// </summary>
        /// <param name="speaker">CodeCampService.Speaker</param>
        /// <returns>Model.Speaker</returns>
        public static Model.Speaker Map(Services.Speaker speaker)
        {
            var modelSpeaker = new Model.Speaker()
                                   {
                                       ImageUrl = speaker.ImageUrl,
                                       Website = speaker.Website,
                                       Email = speaker.Email,
                                       Bio = speaker.Bio,
                                       Twitter = speaker.Twitter,
                                       Blog = speaker.Blog,
                                       Title = speaker.Title,
                                       FirstName = speaker.FirstName,
                                       LastName = speaker.LastName,
                                       IsAdmin = speaker.IsAdmin,
                                       LoginProvider = speaker.LoginProvider
                                   };

            modelSpeaker.Sessions = (List<Model.Session>)speaker.Sessions.Map();
            return modelSpeaker;
        }
        public ActionResult UpdateSpeakersAvatars()
        {
            string localImageUrl = @"/Content/Avatar/default_user_icon.jpg";
            var defaultEvent = service.GetDefaultEvent();
            int eventid = defaultEvent.ID;
            var speakers = service.GetSpeakers(eventid);

            foreach (var speaker in speakers)
            {
                Speaker sp = new Speaker()
                              {
                                  ID = speaker.ID,
                                  Email = speaker.Email,
                                  Twitter = speaker.Twitter,
                                  ImageUrl = speaker.ImageUrl
                              };
                if (string.IsNullOrEmpty(speaker.ImageUrl))
                {
                    var person = service.FindPersonByEmail(sp.Email, sp.LoginProvider);
                    person.ImageUrl = GetImageInfo(person.Twitter, localImageUrl);
                    service.UpdatePerson(person);
                }
            }

            return RedirectToAction("Index", "Administrator");
        }
Exemplo n.º 4
0
        public ActionResult Details(int eventid, int id)
        {
            var speaker = service.GetSpeaker(eventid, id);

            Speaker model = new Speaker()
            {
                ID = speaker.ID,
                Email = speaker.Email,
                FirstName = speaker.FirstName,
                LastName = speaker.LastName,
                Title = speaker.Title,
                Bio = speaker.Bio,
                Website = speaker.Website,
                Blog = speaker.Blog,
                Twitter = speaker.Twitter,
                ImageUrl = speaker.ImageUrl
            };

            foreach (var session in speaker.Sessions)
            {
                if (session.Status == "APPROVED")
                {
                    model.Sessions.Add(new Session()
                    {
                        ID = session.ID,
                        Name = session.Name,
                        Description = session.Description,
                        StartTime = session.StartTime.Value.ToShortTimeString(),
                        EndTime = session.EndTime.Value.ToShortTimeString(),
                        Location = string.IsNullOrEmpty(session.Location) ? string.Empty : session.Location
                    });
                }
            }

            return View(model);
        }