public ActionResult Create(string date) { var dateNow = DateTime.Parse(date); var themeList = _themeRepository.List(); var themes = new List <SelectListItem>(); foreach (var theme in themeList) { themes.Add(new SelectListItem() { Value = theme.Id.ToString(), Text = theme.Title }); } var viewModel = new EventViewModel() { StartTime = dateNow.ToString("yyyy-MM-ddT10:00"), EndTime = dateNow.ToString("yyyy-MM-ddT12:00"), PublishUp = dateNow.ToString("yyyy-MM-ddThh:mm"), Unit = Profilan.SharedKernel.Unit.Minutes, Amount = 120, Themes = themes, ThemeId = "e0614191-56e9-41e3-99be-dcb5b7fedd64" }; return(View(viewModel)); }
public ActionResult Index() { var items = _themeRepository.List(); List <ThemeViewModel> themes = new List <ThemeViewModel>(); foreach (Theme theme in items) { themes.Add(new ThemeViewModel() { Id = theme.Id, Title = theme.Title, Description = theme.Description }); } return(View(themes)); }