根据MVC asp.net身份中的角色显示数据列表 [英] Display list of data on the basis of roles in MVC asp.net identity
本文介绍了根据MVC asp.net身份中的角色显示数据列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个列表,其中显示了由Admin和Users上传的所有视频,但是我想应用一些条件来单独显示User和Admin上传列表(只是想根据角色分开列表).我该怎么做?
I have a list which shows all the videos uploaded by Admin and Users, But I want to apply some condition to individually display User and Admin uploads list (just want to separate list on the basis of roles). How can i do it?
这是显示所有视频的代码
This is the code which displays all the Videos
public ActionResult Index()
{
var videos = db.Videos.Include(v => v.Artist).Include(v => v.Category);
return View(videos.ToList());
}
推荐答案
这是视频课
public class Video
{
public int Id { get; set; }
public virtual Category Category { get; set; }
public int CategoryId { get; set; }
public virtual Artist Artist { get; set; }
public int ArtistId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Length { get; set; }
public string Keywords { get; set; }
public string format { get; set; }
public string Language { get; set; }
public string URL { get; set; }
public string Image { get; set; }
public string UserId { get; set; }
public bool isblock { get; set; }
public virtual ApplicationUser ApplicationUser { get; set; }
public virtual ICollection<Comment> comments { get; set; }
public virtual ICollection<Like> likes { get; set; }
public virtual ICollection<HitCounter> Views { get; set; }
}
这篇关于根据MVC asp.net身份中的角色显示数据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文