Example #1
0
        public String Authentication(string Username, string Password)
        {
            List <GetCustomerByUsername_Result> objList = new List <GetCustomerByUsername_Result>();
            GetCustomerByUsername_Result        objCust = new GetCustomerByUsername_Result();
            Security objSecurity = new Security();
            string   Encry_Password;

            using (var entities = new SedapExpressEntities())
            {
                objList = entities.GetCustomerByUsername(Username).ToList <GetCustomerByUsername_Result>();
            }
            if (objList.Count != 0)
            {
                foreach (GetCustomerByUsername_Result obj in objList)
                {
                    Encry_Password = objSecurity.CreatePasswordHash(Password, obj.PasswordSalt);
                    if (Encry_Password != obj.Password)
                    {
                        objList = new List <GetCustomerByUsername_Result>();
                    }
                }
            }



            return(JsonConvert.SerializeObject(objList));
        }