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:
  1. public string Index()
  2.         {
  3.             //Create a list of genres
  4.             var genres = new List<string> { "Rock", "Jazz", "Country", "Pop", "Disco" };
  5.  
  6.             //Create the view model
  7.             var viewModel = new StoreIndexViewModel
  8.             {
  9.                 NumberOfGenres = genres.Count(), Genres = genres
  10.             };
  11.             return View(viewModel.ToString());
  12.  
  13.         }

Thanks,


Nightwalker