2

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?

gnat
  • 21,442
  • 29
  • 112
  • 288
gog
  • 153
  • 5
  • 2
    ...see also [30 questions linked to it](http://programmers.stackexchange.com/questions/linked/191208?lq=1) – gnat Jun 16 '15 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 Jun 16 '15 at 20:20

0 Answers0