Where should I place this code?

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

On my ASP.NET MVC project I create ViewData classes to pass
information from the controller to the view.

Where should I place the view data classes? Since they kind of reshape
the classes created by the LINQ to SQL I added them do the models.

Not sure if this is the best place to add these classes or even the
best way to do this.

Here is an example:

namespace MyApp.Models
{
public class FilePaper
{
public File File { get; set; }
public List Tags { get; set; }
}
public class FileViewData
{
public PagedList FilesPapers { get; set; }
public FilePaper FilePaper { get; set; }
}
}

In this moment I am using this on the FileController but I suppose
this could be used somewhere else ...

Anyway, just trying to be sure about this since I am still not very
confortable with MVC.

Thanks,

Miguel
 
the convention for MVC is to define viewdata in the models folder. you
probably should make each class it it's own file.


-- bruce (sqlwork.com)
 
Back
Top