public Response<byte> UserLogin(LoginModel Data)
        {
            var objresponse = new Response<byte>();
            var unSeenTalentsMethod = new UnseenTalentsMethod();
            byte result = 0;
            if (Data != null)
            {
                // string pwd = Encryption.Encrypt(Data.Password, ConstantValues.EncryptionKey);
                using (var db = new UnseentalentdbDataContext())
                {
                    User user =
                        db.Users.FirstOrDefault(
                            t =>
                                (t.Email == Data.Email || t.UserName == Data.Email) && t.IsActive == true &&
                                t.IsDeleted == false);
                    if (user != null)
                    {
                        if (user.Password == Data.Password)
                        {
                            var objmethod = new UnseenTalentsMethod();
                            var currentUser = new CurrentUser
                            {
                                Email = user.Email,
                                FirstName = user.UserName,
                                isEmailVerify = true,
                                LastName = user.LastName,
                                ProfilePic = objmethod.ReturnProfilePicture(user.ProfilePic),
                                userid = user.Id,
                                isToken = user.IsToken != null && Convert.ToBoolean(user.IsToken),
                                userrole = unSeenTalentsMethod.GetUserRole(user.Id)
                            };
                            string json = JsonConvert.SerializeObject(currentUser);
                            FormsAuthentication.SetAuthCookie(json, Data.RememberMe);
                            result = 2; //sucess login

                            objresponse.Create(true, 0, "User login successfully", result);
                        }
                        else
                        {
                            result = 0; //Username password not valid
                            objresponse.Create(false, 1, "User login successfully", result);
                        }
                    }
                    else
                    {
                        result = 0;
                        objresponse.Create(false, 1, "User login successfully", result);
                    }
                }
            }
            return objresponse;
        }
        public Response<byte> UserLogin(LoginModel Data)
        {
            Response<byte> objresponse = new Response<byte>();
            byte result = 0;
            if (Data != null)
            {

                // string pwd = Encryption.Encrypt(Data.Password, ConstantValues.EncryptionKey);
                using (var db = new UnseentalentdbDataContext())
                {
                    var user = db.tbl_users.Where(t => t.email == Data.Email && t.isasctive == true && t.isdeleted == false).FirstOrDefault();
                    if (user != null)
                    {

                        if (user.password == Data.Password)
                        {
                            UnseenTalentsMethod objmethod = new UnseenTalentsMethod();
                            CurrentUser currentUser = new CurrentUser()
                            {
                                Email = user.email,
                                FirstName = user.username,
                                isEmailVerify = true,
                                LastName = user.lastname,
                                ProfilePic = objmethod.ReturnProfilePicture(user.profilepic),
                                userid = user.id,
                                isToken = user.isToken == null ? false : Convert.ToBoolean(user.isToken)

                            };
                            string json = JsonConvert.SerializeObject(currentUser);
                            FormsAuthentication.SetAuthCookie(json, Data.RememberMe);
                            result = 2;//sucess login

                            objresponse.Create(true, 0, "User login successfully", result);
                        }
                        else
                        {
                            result = 0; //Username password not valid
                            objresponse.Create(false, 1, "User login successfully", result);
                        }
                    }
                    else
                    {
                        result = 0;
                        objresponse.Create(false, 1, "User login successfully", result);
                    }

                }
            }
            return objresponse;
        }