public async Task <object> GetBy(FacebookUserModel parameters)
        {
            var isMobile = await Uow.Repository <FacebookUser>().SingleOrDefaultAsync(t => t.MobileNo == parameters.Email || t.Email == parameters.Email);

            if (isMobile != null && PasswordHash.VerifySignature(parameters.Password, isMobile.Password, isMobile.Salt))
            {
                isMobile.Token = await ApplicationTokenProvider.GetTokenAsync(isMobile);

                return(isMobile);
            }

            else
            {
                var isEmail = await Uow.Repository <FacebookUser>().SingleOrDefaultAsync(t => t.Email == parameters.Email);

                if (isEmail != null && PasswordHash.VerifySignature(parameters.Password, isEmail.Password, isEmail.Salt))
                {
                    isMobile.Token = await ApplicationTokenProvider.GetTokenAsync(isMobile);

                    return(isMobile);
                }
                else
                {
                    return(0);
                }
                // return "Invalid credentials";
            }
        }
Exemple #2
0
        public async Task <object> GetBy(AppUser parameters)
        {
            var result = await Uow.Repository <AppUser>().SingleOrDefaultAsync(t => t.EmailId == parameters.EmailId);

            if (result != null)
            {
                var token = await ApplicationTokenProvider.GetTokenAsync(result);

                result.token = token;
                return(result);
                // return await Task.FromResult("Successfully Verified");
            }
            else
            {
                return(await Task.FromResult("Enter Correct Email Id"));
            }
            //throw new NotImplementedException();
        }