title: Calling a function from another class in C#/.NET MVC App
body: <p>I'm trying to create better separation of concerns for code reuse in my program, that way I don't have a bloated controller that does all these different things.</p>
  
  <p>for instance, in my application I have a user profile where users can upload a profile pic. If they don't customize their profile pic, I set the default profile pic to an avatar. I do this through a method to check if their profile pic string is null.</p>
  
  <p>I created a folder called <code>HelperMethods</code> and created a class called <code>UserHelperMethods</code> which currently has one function:</p>
  
  <pre><code>namespace HiRatik.Stories.HelperMethods
  {
      public class UserHelperMethods
      {
          //checks if the user's profile pic is null and sets it to default pic if it is
          public string GetUserProfilePic(ApplicationUser user)
          {
              if (user.ProfilePic == null)
              {
                  user.ProfilePic = "profile_pic_default.png";
              }
  
              return user.ProfilePic;
          }
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ldM3F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ldM3F.png" alt="enter image description here"></a></p>
  
  <p>Now, in the controller, under the controller's folder, I added <code>using HiRatik.Stories.HelperMethods;</code></p>
  
  <p>and tried to call the public function <code>GetUserProfilePic</code> from the <code>UserController</code>. But I'm getting an error on the implementation. I'd like to be able to place a lot of these general functions related to users in another class like <code>UserHelperMethods</code> to clean up the bulk in the controller, but I'm missing something on the implementation. the using statement at the top is grayed out, so it's not picking up the function call. Any ideas?</p>
  
  <p><a href="https://i.stack.imgur.com/vBFm9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vBFm9.png" alt="enter image description here"></a></p>