예제 #1
0
 public HttpResponseMessage VerifyAadhar([FromBody] UserModel model, string token)
 {
     if (model.AadharNo.Length == 12)
     {
         bool x = AadharCard.validateVerhoeff(model.AadharNo);
         if (x)
         {
             using (DoctorCorpsEntities context = new DoctorCorpsEntities())
             {
                 UserTable user     = new UserTable();
                 string    username = TokenManager.ValidateToken(token);
                 user = context.UserTable.FirstOrDefault(m => m.UserEmail == username);
                 new UserModel().AadharCard(model, user.UserID);
                 return(Request.CreateResponse(HttpStatusCode.OK, "Your Aadhar Number is verified"));
             }
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "Please Enter a valid Aadhar number"));
         }
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, "Your Aadhar should be 12 digits long"));
     }
 }
예제 #2
0
 public bool IsPhoneExist(string Phone)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         var v = context.UserTable.Where(a => a.UserPhone == Phone).FirstOrDefault();
         return(v != null);
     }
 }
예제 #3
0
 public bool IsEmailExist(string Email)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         var v = context.UserTable.Where(a => a.UserEmail == Email).FirstOrDefault();
         return(v != null);
     }
 }
예제 #4
0
        public string password(string Email)
        {
            DoctorCorpsEntities context = new DoctorCorpsEntities();
            UserTable           us      = new UserTable();

            us = context.UserTable.SingleOrDefault(x => x.UserEmail == Email);
            string pass = Convert.ToString(us.Password);

            return(pass);
        }
예제 #5
0
        public bool verification(string Email)
        {
            DoctorCorpsEntities context = new DoctorCorpsEntities();
            UserTable           Fac     = new UserTable();

            Fac = context.UserTable.SingleOrDefault(m => m.UserEmail == Email);
            var y = Convert.ToBoolean(Fac.IsAccountVerified);

            return(y);
        }
예제 #6
0
 public void AadharCard(UserModel model, int userid)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         UserTable user = new UserTable();
         user                  = context.UserTable.FirstOrDefault(m => m.UserID == userid);
         user.AadharNo         = model.AadharNo;
         user.MedicalHistory   = model.MedicalHistory;
         user.IsAadharVerified = true;
         context.SaveChanges();
     }
 }
예제 #7
0
 public void ResendOTP(int Userid)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         UserTable user = new UserTable();
         user             = context.UserTable.FirstOrDefault(m => m.UserID == Userid);
         user.OTP         = Convert.ToString(GenerateOTP());
         user.OTPDateTime = DateTime.Now;
         context.SaveChanges();
         new SmsService().Messages(new SmsService().Mssg(user, user.OTP));
     }
 }
예제 #8
0
 public int AddPhone(UserTable user)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         user.OTPDateTime = DateTime.Now;
         user.OTP         = Convert.ToString(GenerateOTP());
         context.UserTable.Add(user);
         context.SaveChanges();
         new SmsService().Messages(new SmsService().Mssg(user, user.OTP));
         return(user.UserID);
     }
 }
예제 #9
0
 public UserTable GetUser(string username)
 {
     try
     {
         using (DoctorCorpsEntities context = new DoctorCorpsEntities())
         {
             return(context.UserTable.FirstOrDefault(user => user.UserEmail.Equals(username)));
         }
     }
     catch
     {
         return(null);
     }
 }
예제 #10
0
        public void AddUser(UserModel model, int Userid)
        {
            UserTable user = new UserTable();

            using (DoctorCorpsEntities db = new DoctorCorpsEntities())
            {
                user            = db.UserTable.FirstOrDefault(m => m.UserID == Userid);
                user.UserEmail  = model.UserEmail;
                user.UserName   = model.UserName;
                user.UserGender = model.UserGender;
                user.UserDOB    = model.UserDOB;
                user.Password   = Crypto.Hash(model.Password);
                db.SaveChanges();
            }
        }
예제 #11
0
 public HttpResponseMessage EnterOTP([FromBody] UserModel model, int Userid)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         UserTable user = new UserTable();
         user = context.UserTable.FirstOrDefault(m => m.UserID == Userid);
         bool x = new UserModel().EnterOTP(model, Userid);
         if (x)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, "OTP entered is correct"));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "Please Enter correct OTP"));
         }
     }
 }
예제 #12
0
 public bool IsOTPVerified(int uid)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         UserTable user = new UserTable();
         user = context.UserTable.FirstOrDefault(m => m.UserID == uid);
         TimeSpan s = (TimeSpan)(DateTime.Now - user.OTPDateTime);
         if (s.TotalMinutes <= 2)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #13
0
 public bool EnterOTP(UserModel model, int uid)
 {
     using (DoctorCorpsEntities context = new DoctorCorpsEntities())
     {
         UserTable user = new UserTable();
         user = context.UserTable.FirstOrDefault(m => m.UserID == uid);
         bool x = IsOTPVerified(uid);
         if (user.OTP == model.OTP && x)
         {
             user.IsAccountVerified = true;
             context.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }