Example #1
0
        public uint CreateUser([FromBody] UserDetailStruct newUser)
        {
            if (newUser.firstName.Length < 1 || newUser.lastName.Length < 1)
            {
                // User's name cannot be empty
                var response = new HttpResponseMessage(HttpStatusCode.BadRequest)
                {
                    Content      = new StringContent("User could not be created"),
                    ReasonPhrase = "User cannot have an empty first or last name"
                };
                throw new HttpResponseException(response);
            }
            UserDetailStruct result = new UserDetailStruct();

            result.userID = access.CreateUser();
            access.SelectUser(result.userID);
            access.SetUserName(newUser.firstName, newUser.lastName);

            return(result.userID);
        }
Example #2
0
 public void SetUserName(string fname, string lname)
 {
     userAccess.SetUserName(fname, lname);
     bankDb.SaveToDisk();
 }
Example #3
0
 public void SetUserName(string fname, string lname)
 {
     userAccess.SetUserName(fname, lname);
 }