Beispiel #1
0
        public void AddProduct(string productName, string descr, string photo, string login)
        {
            using (OnlineShop shop = new OnlineShop())
            {
                shop.Products.Add(new Product()
                {
                    ProductName = productName,
                    Description = descr,
                    Photo       = photo,
                    UserLogin   = login
                });

                shop.SaveChanges();
            }
        }
Beispiel #2
0
        public void RegistrationUser(string login, string pass, string nick, string email)
        {
            using (OnlineShop shop = new OnlineShop())
            {
                shop.Users.Add(new User()
                {
                    Login    = login,
                    Password = pass,
                    Nickname = nick,
                    Email    = email
                });

                shop.SaveChanges();
            }
        }
Beispiel #3
0
        public bool VerificationLogin(string login)
        {
            User user = null;
            bool LoginVerified;

            try
            {
                using (OnlineShop shop = new OnlineShop())
                {
                    user = shop.Users.Where(c => c.Login == login).Single();
                }
                LoginVerified = true;
            }
            catch (Exception)
            {
                LoginVerified = false;
            }

            return(LoginVerified);
        }
Beispiel #4
0
        public bool VerificationOnExistUser(string login, string pass)
        {
            User user = null;
            bool IsUserExistUser;

            try
            {
                using (OnlineShop shop = new OnlineShop())
                {
                    user = shop.Users.Where(c => c.Login == login && c.Password == pass).Single(); var result = shop.Products.Where(c => c.UserLogin == login);
                }
                IsUserExistUser = true;
            }
            catch (Exception)
            {
                IsUserExistUser = false;
            }

            return(IsUserExistUser);
        }
Beispiel #5
0
        public bool VerificationEmail(string email)
        {
            User user = null;
            bool EmailVerified;

            try
            {
                using (OnlineShop shop = new OnlineShop())
                {
                    user = shop.Users.Where(c => c.Email == email).Single();
                }
                EmailVerified = true;
            }
            catch (Exception)
            {
                EmailVerified = false;
            }

            return(EmailVerified);
        }
Beispiel #6
0
        public bool VerificationNickname(string nickname)
        {
            User user = null;
            bool NickNameVerified;

            try
            {
                using (OnlineShop shop = new OnlineShop())
                {
                    user = shop.Users.Where(c => c.Nickname == nickname).Single();
                }
                NickNameVerified = true;
            }
            catch (Exception)
            {
                NickNameVerified = false;
            }

            return(NickNameVerified);
        }
Beispiel #7
0
        public bool VerificationOnAdmin(string login, string pass)
        {
            User user             = null;
            bool IsUserExistAdmin = false;

            using (OnlineShop shop = new OnlineShop())
            {
                user = shop.Users.Where(c => c.Login == login && c.Password == pass).Single();
            }

            if (user.IsAdmin == true)
            {
                IsUserExistAdmin = true;
            }
            else
            {
                IsUserExistAdmin = false;
            }


            return(IsUserExistAdmin);
        }