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);
            }
        }
Exemplo n.º 2
0
        public override void CreateRole(string roleName)
        {
            Role newRole = new Role()
            {
                Name = roleName
            };
            GameShopContext db = new GameShopContext();

            db.Roles.Add(newRole);
            db.SaveChanges();
        }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
        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)
 {
 }
Exemplo n.º 7
0
 public CategoriesController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 8
0
 public BillsController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 9
0
 public ShoppingCartsController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 10
0
 public WishListRepository(GameShopContext context)
     : base(context)
 {
 }
Exemplo n.º 11
0
 public StudiosController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 12
0
 public ClientsController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 13
0
 public ProductsController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 14
0
 public BasketsController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 15
0
 public ProductRepository(GameShopContext context)
     : base(context)
 {
 }
Exemplo n.º 16
0
 public UserReviewsController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 17
0
 public OrderRepository(GameShopContext context)
     : base(context)
 {
 }
Exemplo n.º 18
0
 public ConsolesController(GameShopContext context)
 {
     _context = context;
 }
Exemplo n.º 19
0
 public CartRepository(GameShopContext context)
     : base(context)
 {
 }