//public virtual DbSet<Get_PubUserPasswordViewModel> GetPubUserPasswordResults { get; set; }

        public PubUsers AddPubUser(PubUsers model)
        {
            SqlParameter @outputParam = new SqlParameter {
                ParameterName = "@outputParam", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Output
            };

            Database.ExecuteSqlRaw("EXEC @outputParam=Add_PubUser @UserFirstName, @UserLastName, @UserAccessRank, @UserPassword",
                                   outputParam,
                                   new SqlParameter("@UserFirstName", model.UserFirstName),
                                   new SqlParameter("@UserLastName", model.UserLastName),
                                   new SqlParameter("@UserAccessRank", model.UserAccessRank.ToString()),
                                   new SqlParameter("@UserPassword", model.UserPassword));
            int result = (int)@outputParam.Value; //User ID is returned. Can return the value from the stored procedure as User ID is an integer.

            if (result > 0)
            {
                model.UserId = result;
                return(model);
            }
            return(null);
        }
        public PubUsers GetPubUser(int UserId)
        {
            var results = GetPubUserResults.FromSqlRaw("EXEC Get_PubUser @UserID",
                                                       new SqlParameter("@UserID", UserId)).ToList();

            if (results.Count() > 0)
            {
                PubUsers output = new PubUsers {
                    UserId            = results.First().UserID,
                    UserPassword      = results.First().UserPassword,
                    UserFirstName     = results.First().UserFirstName,
                    UserLastName      = results.First().UserLastName,
                    UserAccessRank    = UserRank.GetRank(results.First().UserAccessRank),
                    UserOrderBasketID = results.First().UserOrderBasketID ?? 0
                };
                //If results are returned then the user has been found. As the user is unique, their will only be one result so the password is fetched from the first (only) result.
                return(output);
            }
            else
            {
                return(null); //no results returned - user ID dosen't exist in DB so give nothing.
            }
        }