public ActionResult NewMentor() { var userInfo = UserHelper.GetCurrentUserInfo(); if (!userInfo.IsInRole(UserRoleCode.Mentor)) { var allTopics = _topicService.GetAll(); var topics = allTopics.Select(t => new TopicModel { Checked = false, Description = t.Description, Id = t.Id }); var allTimeSlots = _timeSlotService.GetAll(); var availability = allTimeSlots.Select(t => new TimeSlotModel { Checked = false, Description = t.Description, Id = t.Id }); var allMenteeSeniorityLevels = _menteeSeniorityService.GetAll(); var menteeSeniority = allMenteeSeniorityLevels.Select(s => new MenteeSeniorityModel { Id = s.Id, Checked = false, Description = s.Description }); var meetingMode = from MeetingMode e in Enum.GetValues(typeof(MeetingMode)) select new { Value = e.ToString(), Text = EnumExtension.GetEnumDescription(e) }; ViewBag.MeetingModes = new SelectList(meetingMode, "Value", "Text"); return(View(new NewMentorModel { Topics = topics.ToList(), Availability = availability.ToList(), SeniorityLevel = menteeSeniority.ToList(), Seniority = !userInfo.Seniority.Equals("unknown") ? userInfo.Seniority : string.Empty, Location = !userInfo.Location.Equals("unknown") ? userInfo.Location : string.Empty, })); } return(View("Unauthorized")); }
public IActionResult Get() { var response = _mapper.Map <List <TimeSlot>, List <TimeSlotViewModel> >((List <TimeSlot>)_timeSlots.GetAll()); return(StatusCode((int)HttpStatusCode.OK, response)); }