/// <summary> /// Finds if the user is correct /// </summary> /// <param name="Username"></param> /// <param name="Password"></param> /// <returns> /// 0. True /// 1. False /// 2. Error connecting DB /// </returns> public int isVerifiedUser(string Username, string Password) { IQueryable <Users> UserQuery; try //Trying connection to the DB { _Db.Database.Migrate(); UserQuery = _Db.Users.Where(a => a.Username == Username && a.Password == Password); //Creating the Query for the verification } catch (Exception e) //Error connecting to the DB { return(2); } try //Finding the user { Users User = UserQuery.First(); return(0); //User found and thus returning zero indicating Verified User } catch (Exception e) { return(1); //User not found and thus return 1 indicating inValid user } }