public static string sendNewPassword(string email, string answer)
        {
            List <Donor> lc    = GetAllDonors();
            Donor        donor = lc.Where(x => x.email == email && x.securityAnswer.Equals(answer)).FirstOrDefault();

            List <Requestor> lr        = RequestorRepository.GetAllRequestors();
            Requestor        requestor = lr.Where(x => x.email == email && x.securityAnswer.Equals(answer)).FirstOrDefault();

            if (donor != null || requestor != null)
            {
                string word = "";

                for (int i = 0; i < 5; i++)
                {
                    word += RandomLetter();
                }



                var data = Encoding.UTF8.GetBytes(word);


                byte[] hash;

                using (SHA512 sha = new SHA512Managed())
                {
                    hash = sha.ComputeHash(data);
                }

                string hashString = Encoding.Default.GetString(hash);

                hashString = stringToHex(hashString);
                hashString = hashString.ToLower();



                if (donor != null)
                {
                    donor.password = hashString;
                    UpdateDonor(donor.Id, donor);
                    //dataContext.SaveChanges();

                    return("true-" + word);
                }
                else
                {
                    requestor.password = hashString;
                    RequestorRepository.UpdateRequestor(requestor.Id, requestor);
                    //dataContext.SaveChanges();
                    return("true-" + word);
                }
            }
            return("false-Incorrect answer");
        }
        public static Boolean isUserDuplicated(Donor a)
        {
            List <Donor> lc    = GetAllDonors();
            Donor        donor = lc.Where(x => x.email == a.email || x.dni.ToLower().Equals(a.dni.ToLower())).FirstOrDefault();

            List <Requestor> lr        = RequestorRepository.GetAllRequestors();
            Requestor        requestor = lr.Where(x => x.email == a.email || x.dni.ToLower().Equals(a.dni.ToLower())).FirstOrDefault();

            if (donor != null || requestor != null)
            {
                return(true);
            }
            return(false);
        }
        public static string getSecurityQuestionByMail(string email)
        {
            List <Donor> lc    = GetAllDonors();
            Donor        donor = lc.Where(x => x.email == email).FirstOrDefault();

            List <Requestor> lr        = RequestorRepository.GetAllRequestors();
            Requestor        requestor = lr.Where(x => x.email == email).FirstOrDefault();

            if (donor != null || requestor != null)
            {
                if (donor != null)
                {
                    return(donor.securityQuestion);
                }
                else
                {
                    return(requestor.securityQuestion);
                }
            }
            return(null);
        }
        public static string CanLoginBoth(Donor a)
        {
            dataContext = new RobaSegonaMaEntities(false);
            List <Donor> lc    = GetAllDonors();
            Donor        donor = lc.Where(x => x.password == a.password && x.email == a.email && x.active == true).FirstOrDefault();

            List <Requestor> lr = RequestorRepository.GetAllRequestors();
            // Requestor requestor = lr.Where(x => x.password == a.password && x.email == a.email && x.active == true && x.Status.status1.ToLower().Equals("activated")).FirstOrDefault();
            Requestor requestor = lr.Where(x => x.password == a.password && x.email == a.email && x.active == true && x.Status_Id == 2).FirstOrDefault();

            if (donor != null || requestor != null)
            {
                if (donor != null)
                {
                    return("true-" + "Donor-" + donor.Id);
                }
                else
                {
                    return("true-" + "Requestor-" + requestor.Id);
                }
            }
            return("false");
        }