Ejemplo n.º 1
0
        private bool IsLogin(string username, string password)
        {
            try
            {
                MyCaseNewEntities db = new MyCaseNewEntities();
                var success          = false;
                var getUser          = (from lo in db.LoginUsers
                                        where lo.Username == username && lo.Password == password
                                        select new
                {
                    lo.Username,
                    lo.Password
                }).FirstOrDefault();

                if (getUser != null)
                {
                    success = true;
                }
                return(success);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        private List <LoginVM> GetLogins(string username, string password)
        {
            List <LoginVM> loginVMs = new List <LoginVM>();

            //password = LegalGuideUtility.Encrypt(password);
            try
            {
                MyCaseNewEntities db = new MyCaseNewEntities();

                var getUsers = db.LoginUsers.Where(u => u.Username == username && u.Password == password).Select(u => new LoginVM
                {
                    Username = u.Username,
                    Password = u.Password,
                    RoleId   = (int)u.RoleId
                });

                foreach (var item in getUsers)
                {
                    loginVMs.Add(new LoginVM
                    {
                        Username = item.Username,
                        Password = item.Password,
                        RoleId   = item.RoleId
                    });
                }

                return(loginVMs);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }