title: how to Pass parameter with dynamic model class in Ntier MVC c#
body: <p>Firstly, </p>
  
  <p>My controller code is ;</p>
  
  <pre><code>public ActionResult Menuler_Delete(int id)
          {
             Menuler val = general_service.getMenu(id);
              general_service.Delete(val);
  
              return RedirectToAction("Menuler", "Admin");
           }
  </code></pre>
  
  <p>My generalservice code is ;</p>
  
  <pre><code>public Menuler getMenu(int id)
          {
              MenulerService mservice = new MenulerService();
  
              return mservice.getMenu(id);
  
          }
          public void Delete( T model ) 
          {
              DbIslemler&lt;T&gt; islem = new DbIslemler&lt;T&gt;();
              islem.Delete(model);
          }
  </code></pre>
  
  <p>menulerservice code is ;</p>
  
  <pre><code>public class MenulerService
      {
          DbIslemler&lt;Menuler&gt; menuler_service = new DbIslemler&lt;Menuler&gt;();
  
          public Menuler getMenu( int id)
          {
             return menuler_service.Find(id);
          }
  
      }
  </code></pre>
  
  <p>my DBIslemler code is ;</p>
  
  <pre><code>public class DbIslemler&lt;T&gt; : IDbIslemler&lt;T&gt; where T : class
      {
   public void Delete(T model)
          {
              _database.Set&lt;T&gt;().Remove(model);
              _database.SaveChanges();
          }
  
          public void Delete(object id)
          {
              T val = _database.Set&lt;T&gt;().Find(id);
              _database.Set&lt;T&gt;().Remove(val);
              _database.SaveChanges();
          }
  
  public T Find(object id)
          {
             return _database.Set&lt;T&gt;().Find(id);
  
          }
  }
  
  namespace NTierMvc.DataAccess
  {
      public class DataBase : DbContext
      {
  
          public DbSet&lt;Popup&gt; Popups { get; set; }
  
          public DbSet&lt;New&gt; News{ get; set; }
  
          public DbSet&lt;Menuler&gt; Menulers { get; set; }
      }
  
  }
  </code></pre>
  
  <p>Now, I want to pass  <strong>void Delete( T model )</strong> value controller to general service. But my model class ( that's T ) changeable. Be Sometimes void Delete ( <strong>Menu</strong> model) , sometimes void Delete(<strong>Popup</strong> model) , sometimes void Delete(<strong>News</strong> model) </p>
  
  <p>how can i do this?
  Thanks.</p>