I'm developing an ASP.NET MVC 5 website and I have a view with a grid. In this grid I have a column which represents an URL property.

This url is a link to download some files, but this url should be available only in certain conditions i.e:

   public static GetLinkStatus ValidateLint(RequestDTO request, string currentVersion)
  if (request.Link == null)
            return LinkStatus.Processing;
  if (request.ExpirationDate < DateTime.Now)
            return LinkStatus.OutOfDate;
  if (request.Version.Equals(currentVersion))
            return LinkStatus.Available;

  return LinkStatus.Unavailable;

And in the View I call this static method to check the status and according to this, render some html.

My question is, if there a better way to deal with those 'ifs' conditionals statements?

  • 2
    ...see also 30 questions linked to it
    – gnat
    Commented Jun 16, 2015 at 18:48
  • 1
    You should worry about more subtle issues than attempting to optimize 3 ifs that are not even in a loop!
    – NoChance
    Commented Jun 16, 2015 at 20:20