public ViewResult AddAlbum() { var alb = _photoRepository.GetAlbums(); SelectList teams = new SelectList(alb, "id", "Name"); ViewBag.Albums = teams; return(View("AddAlbum", new Albums())); }
public ContentResult GetPhotoAlbumsHtml() { var photoAlbumses = _photoRepository.GetAlbums().OrderBy(s => s.Name); var sb = new StringBuilder(); sb.AppendLine(@"<select>"); foreach (var category in photoAlbumses) { sb.AppendLine(string.Format(@"<option value=""{0}"">{1}</option>", category.id, category.Name)); } sb.AppendLine("<select>"); return(Content(sb.ToString(), "text/html")); }