using System.Collections.Generic;
namespace HelloWorldMvcApp
public class HomeController : Controller
public ActionResult Index()
var g1 = new Genre{Name="A", Id=1};
var g2 = new Genre{Name="B", Id=2};
List<LectureGig> l = new List<LectureGig>();
var lecture = new LectureGig();
lecture.Genre = i%2==0 ? g1:g2;
ViewBag.genres = l.GroupBy(g=>g.Genre.Name).Select(g=> new KeyValuePair<string, int>(g.Key,g.Count())).ToList();
return View(new SampleViewModel());
public JsonResult GetAnswer(string question)
int index = _rnd.Next(_db.Count);
private static Random _rnd = new Random();
private static List<string> _db = new List<string> { "Yes", "No", "Definitely, yes", "I don't know", "Looks like, yes"} ;