public bool Login(string login, string password) { using (var db = new GameShopContext()) { var customer = db.Customers.FirstOrDefault(x => x.Login == login && x.Password == password); return(customer != null); } }
public override void CreateRole(string roleName) { Role newRole = new Role() { Name = roleName }; GameShopContext db = new GameShopContext(); db.Roles.Add(newRole); db.SaveChanges(); }
public override string[] GetRolesForUser(string username) { string[] role = new string[] { }; using (GameShopContext db = new GameShopContext()) { // Получаем пользователя Customer customer = db.Customers.FirstOrDefault(u => u.Login == username); if (customer != null) { // получаем роль Role userRole = db.Roles.Find(customer.RoleId); if (userRole != null) { role = new string[] { userRole.Name } } ; } } return(role); }
public override bool IsUserInRole(string username, string roleName) { bool outputResult = false; // Находим пользователя using (GameShopContext db = new GameShopContext()) { // Получаем пользователя Customer customer = db.Customers.FirstOrDefault(u => u.Email == username); if (customer != null) { // получаем роль Role userRole = db.Roles.Find(customer.RoleId); //сравниваем if (userRole != null && userRole.Name == roleName) { outputResult = true; } } } return(outputResult); }
public ParameterValueRepository(GameShopContext context) : base(context) { }
public ParameterGroupRepository(GameShopContext context) : base(context) { }
public CategoriesController(GameShopContext context) { _context = context; }
public BillsController(GameShopContext context) { _context = context; }
public ShoppingCartsController(GameShopContext context) { _context = context; }
public WishListRepository(GameShopContext context) : base(context) { }
public StudiosController(GameShopContext context) { _context = context; }
public ClientsController(GameShopContext context) { _context = context; }
public ProductsController(GameShopContext context) { _context = context; }
public BasketsController(GameShopContext context) { _context = context; }
public ProductRepository(GameShopContext context) : base(context) { }
public UserReviewsController(GameShopContext context) { _context = context; }
public OrderRepository(GameShopContext context) : base(context) { }
public ConsolesController(GameShopContext context) { _context = context; }
public CartRepository(GameShopContext context) : base(context) { }