Newbie-ish questions ahead:
Where should I put my View Model declarations?
I created a file called "ViewModels.cs" in my Models folder. I created a few View Model classes, including one called RatingViewModel:
using System;
using System.Collections.Generic;var
using System.Linq;
using System.Web;
namespace Web.Model
{
public class ViewModels
{
public class RatingViewModel
{
public User Rater { get; set; }
public Rating Rating { get; set; }
}
}
}V
Now I'm trying to create a helper/service class function that returns a new RatingViewModel object.
I created a "RatingsHelpers.cs" file. But when I try to crate a new RatingViewModel object, it has no idea what I'm talking about. I can't figure it out. Am I missing some reference? How can I create/return a new View Model object from my helper/service class?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using Web.Model;
namespace System.Web.Mvc
{
public static class RatingsHelpers
{
public static RatingViewModel functionname()
{ ..... }
But it doesn't know what "RatingViewModel" is...!?!?!?
I just know this should be obvious.
Pulling my hair out,
Johnny