Where should I place this code?

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top