Hi,
How do I convert a view model to a string? This is what I have tried but it still returning the error "Cannot implicitly convert type 'System.Web.Mvc.ViewResult' to 'string'".
asp Code:
public string Index() { //Create a list of genres var genres = new List<string> { "Rock", "Jazz", "Country", "Pop", "Disco" }; //Create the view model var viewModel = new StoreIndexViewModel { NumberOfGenres = genres.Count(), Genres = genres }; return View(viewModel.ToString()); }
Thanks,
Nightwalker




Reply With Quote