Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public ActionResult Index()
        {
            //get all session from database
            var classs = _SessionClassService.GetAll();
            var model  = new AttendeeFilterViewModel();

            model.AttendeeSessionFilter = new List <SessionFilterViewModel>();

            foreach (var c in classs.Select(a => new { a.SessionTopicID, a.SessionTopic.Name }).Distinct())
            {
                var times      = classs.Where(a => a.SessionTopicID == c.SessionTopicID);
                var sessionRow = new SessionFilterViewModel();

                //default value of the checkbox not selected
                sessionRow.IsSelected       = false;
                sessionRow.SessionTopicName = c.Name;
                sessionRow.SessionTopicID   = c.SessionTopicID;
                sessionRow.TimeSlots        = new List <TimeSlot>();

                foreach (var time in times)
                {
                    sessionRow.TimeSlots.Add(new TimeSlot()
                    {
                        SessionClassID = time.Id, IsSelected = false, Date = time.StartDate, From = time.StartDate, To = time.EndDate
                    });
                }

                model.AttendeeSessionFilter.Add(sessionRow);
            }

            return(View(model));
        }
Exemplo n.º 2
0
        // GET: SessionClass
        public ActionResult Index()
        {
            var Classs = _SessionClassService.GetAll();


            var result = Mapper.Map <IEnumerable <SessionClass>, IEnumerable <SessionClassViewModel> >(Classs);


            return(View(result));
        }