public override string[] GetAllRoles() { using (var statosContext = new StatosContext()) { return(statosContext.Roles.Select(r => r.RoleName).ToArray()); } }
public override bool IsUserInRole(string username, string roleName) { using (var statosContext = new StatosContext()) { var user = statosContext.Account.SingleOrDefault(u => u.UserName == username); if (user == null) { return(false); } return(user.UserRoles != null && user.UserRoles.Select( u => u.Role).Any(r => r.RoleName == roleName)); } }
public override string[] GetRolesForUser(string username) { using (var statosContext = new StatosContext()) { var user = statosContext.Account.SingleOrDefault(u => u.UserName == username); if (user == null) { return new string[] { } } ; return(user.UserRoles == null ? new string[] { } : user.UserRoles.Select(u => u.Role).Select(u => u.RoleName).ToArray()); } }
/// <summary> /// Advance Search is a /// </summary> /// <returns></returns> public ActionResult Advanced(SearchViewModel searchViewModel) { if (ModelState.IsValid && string.IsNullOrEmpty(searchViewModel.ToString())) { var entities = new StatosContext(); var results = entities.Product.Where( s => s.Name.StartsWith(searchViewModel.ProductName) || s.Brand.Name.Equals(searchViewModel.Brand) || s.Categories.Any(c => c.Name.Equals(searchViewModel.Category))) .OrderBy(o => o.CreationTime); var pageIndex = searchViewModel.Page ?? 0; searchViewModel.SearchResults = results.ToPagedList(pageIndex, 25); } return(View()); }
/// <summary> /// /// </summary> /// <param name="searchViewModel"></param> /// <returns></returns> public ActionResult List(SearchViewModel searchViewModel) { if (!string.IsNullOrEmpty(searchViewModel.ProductName)) { var entities = new StatosContext(); var results = entities.Product.Where( c => c.Name.StartsWith(searchViewModel.ProductName)) .OrderBy(o => o.CreationTime); var pageIndex = searchViewModel.Page ?? 0; searchViewModel.SearchResults = results.ToPagedList(pageIndex, 25); ViewBag.SearchParameters = searchViewModel; } return(View(searchViewModel)); }
public ContentRepository(StatosContext statosContext) : base(statosContext) { _statosContext = statosContext; }
public StoreRepository(StatosContext statosContext) : base(statosContext) { }
public LanguageRepository(StatosContext statosContext) : base(statosContext) { }
public BlogRepository(StatosContext statosContext) : base(statosContext) { _statosContext = statosContext; }
public AccountRepository(StatosContext statosContext) : base(statosContext) { }
public ContactRepository(StatosContext statosContext) : base(statosContext) { }
public MemberRepository(StatosContext statosContext) : base(statosContext) { }
public ProductRepository(StatosContext statosContext) : base(statosContext) { _statosContext = statosContext; }