// GET: Test public ActionResult Index() { UvoyageDBContext db = new UvoyageDBContext(); List <PhongKhachSan> ListPhong = db.PhongKhachSans.ToList(); return(View(ListPhong)); }
public bool IsInRole(string role) { var roles = role.Split(new char[] { ',' }); UvoyageDBContext db = new UvoyageDBContext(); string username = (HttpContext.Current.Session["DangNhap"] as Account).username; bool kq = (from UserInRole in db.UserInRoles join Role in db.Roles on UserInRole.ID_Role equals Role.ID where UserInRole.Username == username select Role.RoleName).Any(r => roles.Contains(r)); return(kq); }