I'm completely new to Razor engine, so may be my question look silly. Anyway. I need to use partial view in main view and I'm passing my model that inherited IQueryable interface. This look like that:

 @{Html.RenderPartial("~/Views/comments/Details.cshtml", new IQueryable<BlogAspNetMVC.Models.comments>);}

Partial view model:

@model IQueryable<BlogAspNetMVC.Models.comments>

How should I change RenderPartial to be able accept this model as argument?

P.S. Here is comments model:

  public partial class comments
        public int ID { get; set; }
        public string Comment { get; set; }
        public Nullable<int> Author { get; set; }
        public Nullable<System.DateTime> Posted { get; set; }
        public Nullable<int> PostID { get; set; }

        public virtual blog_post blog_post { get; set; }

Here is Icomments interface:

public interface IComments : IDisposable
    IQueryable<comments> GetPostComments(int postid);
    //void Add(comments comment);
    //void Update(comments comment);
    //void Remove(int id);

This how implemented in repository:

public IQueryable<comments> GetPostComments(int postid)
            var all = from a in db.comments
                      orderby a.Posted descending
                      where a.PostID == postid
                      select a;
            return all.AsQueryable();

Related posts

Recent Viewed