title: ViewModel MVC 5 created using 2 classes, controller which using it
body: <p>It is not a new topic, however even after reading through many of them, i'm still not fully understand how i can implement them in my case. looking for your advise. </p>
  
  <p>I have two classes. </p>
  
  <pre><code>public class Media
      {
          public int Id { get; set; }
          public string title { get; set; }
          public string description { get; set; }
          public string body { get; set; }
          public string ImagePath { get; set; }
      }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Video
      {
          public int ID { get; set; }
          public string Title { get; set; }
          public string Description { get; set; }
          public string VideoLink { get; set; }
          public string tags { get; set; }
      }
  </code></pre>
  
  <p>At the moment i have two controllers for each of them <code>MediasController</code> and <code>VideosController</code>, each of them works with <code>MediaMain</code> view and <code>VideoMain</code> view. In result i can show two objects on two separate views. We are talking about sort of a media blog website, were news may differ, they may be text only,text + image or text + video. Every new "media" should populate on One view. </p>
  
  <p>If we are talking on a high level, i think i should create a new viewModel class to gather into it those fields which i need to show on viewmodel page, right? here is what i have:</p>
  
  <pre><code>public class MediaViewModel
      {
          public class Media 
          { 
                  public string title { get; set; }
                  public string description { get; set; }
                  public string body { get; set; }
                  public string ImagePath { get; set; }
          }
          public class Video 
          {
              public string Title { get; set; }
              public string Description { get; set; }
              public string VideoLink { get; set; }
          }
  }
  </code></pre>
  
  <p>Now, if that correct i should have a ViewModelController made of this class, right? Or maybe i need a collection of both classes? 
  What i mean is something like this:</p>
  
  <pre><code>public class MediaViewModel
          {
              public class Media 
              { 
                      public string title { get; set; }
                      public string description { get; set; }
                      public string body { get; set; }
                      public string ImagePath { get; set; }
  
                      **public Video Video{ get; set; }**
              }
      }
  </code></pre>
  
  <p>Please help.</p>