コード例 #1
0
        //Login
        public int ValidateLoginFromDB(UserLS userLS)
        {
            var UserSearchInDB = _ctx.UserLSs
                                 .Where(s => s.UserName == userLS.UserName)
                                 .First();

            //Not found
            if (UserSearchInDB == null)
            {
                return(0);
            }
            //User password validation
            if (String.Compare(UserSearchInDB.Password, userLS.Password) == 0)
            {
                if (UserSearchInDB.IsAdmin)
                {
                    return(5);   //Admin
                }
                else
                {
                    return(2);   //General user
                }
            }
            //Password error
            return(1);
        }
コード例 #2
0
        public static UserLS CreateNewUserLSFromBody(UserLS userLSFromBody)
        {
            UserLS newUserLS = new UserLS();

            newUserLS.StudentId = userLSFromBody.StudentId;

            return(newUserLS);
        }
コード例 #3
0
 public void AddUser(UserLS userLS)
 {
     _ctx.UserLSs.Add(userLS);
     Save();
 }