title: How many if conditions should I use in Razor View Engine MVC3?
body: <p>I used too many IF conditions in my MVC3 Razor view - almost 230 if conditions on the to compare two or more values. The problem is that it's using too much memory and processor on the server. That's why server response time is very slow over 6 sec average.</p>
  
  <p>What should I do? Should I reduce using If conditions or is there any alternative?</p>
  
  <p>(I can post my code here too)</p>
  
  <p>Update with Code: </p>
  
  <p>Controller: </p>
  
  <pre><code> public ActionResult Index(string query)
             {
              name1 = query.Substring(0, query.IndexOf("-vs-"));
              name2 = query.Substring(query.IndexOf("-vs-") + 1, query.Length - query.IndexOf("-vs-") - 1);
              name2 = name2.Replace("vs-", "");
  var model = _comp.GetViewModel(name1 , name2 );
  </code></pre>
  
  <p>}</p>
  
  <p>Mode:</p>
  
  <pre><code> public CpusViewModel GetViewModel(int? id1, int? id2)
      {
          if (id1 == null) return null;
          if (id2 == null) return null;
  
          var cpu1 = _comp.Get(p =&gt; p.cpuId == id1);
          if (cpu1 == null) return null;
  
          var cpu2 = _comp.Get(p =&gt; p.cpuId == id2);
          if (cpu2 == null) return null;
  
          return new CpusViewModel
          {
              CPUId1 = cpu1.cpuId,
              CPUImage1 = cpu1.cpuImageName,
              CPUImageFolder1 = cpu1.cpuImageName.Substring(0,1),
              CpuMunafacturer1 = cpu1.cpuMunafacturer,
              CpuFamily1 = cpu1.cpuFamily,
              CpuModel1 = cpu1.cpuModel,
              CpuQuery1 = cpu1.cpuQuery,
              CpuTitle1 = cpu1.cpuQuery.Replace("-"," "),
              CpuSummaryClockSpeedNodeText1 = cpu1.cpuSummaryClockSpeedNodeText,
              CpuSummaryCoredNodeText1 = cpu1.cpuSummaryCoredNodeText,
              CpuSummaryIsUnlockedNodeText1 = cpu1.cpuSummaryIsUnlockedNodeText,
              CpuFeaturedReview1 = cpu1.cpuFeaturedReview,
              CpuFeaturedReviewLinkAndDate1 = cpu1.cpuFeaturedReviewLinkAndDate,
              CpusortMainBassScore1 = cpu1.cpuBossValueScoreNew,
              CpuOverclockingScoreNew1 = cpu1.cpuOverclockingScoreNew,
              CpuSingleCorePerformanceScoreNew1 = cpu1.cpuSingleCorePerformanceScoreNew,
              CpusortBenchmarkPerformanceScoreNew1 = cpu1.cpusortBenchmarkPerformanceScoreNew,
              CpuValueScoreNew1 = cpu1.cpuValueScoreNew,
              CpuBenchmaKX264HD4PASS1NodeText1 = cpu1.cpuBenchmaKX264HD4PASS1NodeText,
              CpuBenchmaKX264HD4PASS2NodeText1 = cpu1.cpuBenchmaKX264HD4PASS2NodeText,
              CpuBenchmaCinebenchR1032BitNodeText1 = cpu1.cpuBenchmaCinebenchR1032BitNodeText,
              CpuBenchmaCinebenchR1032Bit1CoreNodeText1 = cpu1.cpuBenchmaCinebenchR1032Bit1CoreNodeText,
              CpuBenchmarkPerformancePerDollarNodeText1 = cpu1.cpuBenchmarkPerformancePerDollarNodeText,
              CpuBenchmarkSysMark20073DNodeText1 = cpu1.cpuBenchmarkSysMark20073DNodeText,
              CpuBenchmarkSysMark2007ProductivityNodeText1 = cpu1.cpuBenchmarkSysMark2007ProductivityNodeText,
              CpuBenchmarkSysMark2007VideoCreationNodeText1 = cpu1.cpuBenchmarkSysMark2007VideoCreationNodeText,
              CpuBenchmarkCinebenchR11_5NodeText1 = cpu1.cpuBenchmarkCinebenchR11_5NodeText,
              CpuBenchmarkCinebenchR11_5_SingleNodeText1 = cpu1.cpuBenchmarkCinebenchR11_5_SingleNodeText,
              CpuBenchmark3DMark06CPUNodeText1 = cpu1.cpuBenchmark3DMark06CPUNodeText,
              CpuBenchmark3DMark11PhysicsNodeText1 = cpu1.cpuBenchmark3DMark11PhysicsNodeText,
              CpuBenchmarkPassMarkNodeText1 = cpu1.cpuBenchmarkPassMarkNodeText,
              CpuBenchmarkPassMarkSingleCoreNodeText1 = cpu1.cpuBenchmarkPassMarkSingleCoreNodeText,
              CpuBenchmarkGeekBenchNodeText1 = cpu1.cpuBenchmarkGeekBenchNodeText,
              CpuBenchmarkX264HD4NodeText1 = cpu1.cpuBenchmarkX264HD4NodeText,
              CpuBenchmarSysMark2007OverallNodeText1 = cpu1.cpuBenchmarSysMark2007OverallNodeText,
              CpuGeneralCodeNameNodeText1 = cpu1.cpuGeneralCodeNameNodeText,
              CpuGeneralMarketNodeText1 = cpu1.cpuGeneralMarketNodeText,
              CpuGeneralManuProductPageNodeText1 = cpu1.cpuGeneralManuProductPageNodeText,
              CpuSummaryTurboClockSpeedNodeText1 = cpu1.cpuSummaryTurboClockSpeedNodeText,
              CpuSummarySocketTypeNodeText1 = cpu1.cpuSummarySocketTypeNodeText,
              CpuSummaryIsHyperthreadedNodeText1 = cpu1.cpuSummaryIsHyperthreadedNodeText,
              CpuDetailsArchitectureNodeText1 = cpu1.cpuDetailsArchitectureNodeText,
              CpuDetailsThreadsNodeText1 = cpu1.cpuDetailsThreadsNodeText,
              CpuDetailsL2CacheNodeText1 = cpu1.cpuDetailsL2CacheNodeText,
              CpuDetailsL2CachePerCoreNodeText1 = cpu1.cpuDetailsL2CachePerCoreNodeText,
              CpuDetailsL3CacheNodeText1 = cpu1.cpuDetailsL3CacheNodeText,
              CpuDetailsL3CachePerCoreNodeText1 = cpu1.cpuDetailsL3CachePerCoreNodeText,
              CpuDetailsManufactureProcessNodeText1 = cpu1.cpuDetailsManufactureProcessNodeText,
              CpuDetailsTransistorCountNodeText1 = cpu1.cpuDetailsTransistorCountNodeText,
              CpuDetailsMaxCPUsNodeText1 = cpu1.cpuDetailsMaxCPUsNodeText,
              CpuDetailsClockMultiplierNodeText1 = cpu1.cpuDetailsClockMultiplierNodeText,
              CpuDetailsVoltageRangeNodeText1 = cpu1.cpuDetailsVoltageRangeNodeText,
              CpuDetailsOperatingTempNodeText1 = cpu1.cpuDetailsOperatingTempNodeText,
              CpuFeaturesNXBitNodeText1 = cpu1.cpuFeaturesNXBitNodeText,
              CpuFeaturesTrustedComputingNodeText1 = cpu1.cpuFeaturesTrustedComputingNodeText,
              CpuFeaturesVirtualizationSupportNodeText1 = cpu1.cpuFeaturesVirtualizationSupportNodeText,
              CpuFeaturesInstructionSetExtensionsNodeText1 = cpu1.cpuFeaturesInstructionSetExtensionsNodeText,
              CpuFeaturesDynamicFrequencyScalingNodeText1 = cpu1.cpuFeaturesDynamicFrequencyScalingNodeText,
              CpuOverclockingOverclockPopulartyNodeText1 = cpu1.cpuOverclockingOverclockPopulartyNodeText,
              CpuOverclockingOverclockReviewScoreNodeText1 = cpu1.cpuOverclockingOverclockReviewScoreNodeText,
              CpuOverclockingOverclockedClockSpeedNodeText1 = cpu1.cpuOverclockingOverclockedClockSpeedNodeText,
              CpuOverclockingOverclockedClockSpeedWaterNodeText1 = cpu1.cpuOverclockingOverclockedClockSpeedWaterNodeText,
              CpuOverclockingPassmarkOverclockedNodeText1 = cpu1.cpuOverclockingPassmarkOverclockedNodeText,
              CpuOverclockingOverclockedClockSpeedAirNodeText1 = cpu1.cpuOverclockingOverclockedClockSpeedAirNodeText,
              CpuGPUGpuNodeText1 = cpu1.cpuGPUGpuNodeText,
              CpuGPULabelNodeText1 = cpu1.cpuGPULabelNodeText,
              CpuGPULatestDirectXNodeText1 = cpu1.cpuGPULatestDirectXNodeText,
              CpuGPUNumberDisplaysSupportedNodeText1 = cpu1.cpuGPUNumberDisplaysSupportedNodeText,
              CpuGPUClockSpeedNodeText1 = cpu1.cpuGPUClockSpeedNodeText,
              CpuGPUTurboClockSpeedNodeText1 = cpu1.cpuGPUTurboClockSpeedNodeText,
              CpuGPU3DMark06NodeText1 = cpu1.cpuGPU3DMark06NodeText,
              CpuPowerTDPNodeText1 = cpu1.cpuPowerTDPNodeText,
              CpuPowerAnnualHomeEnergyCostNodeText1 = cpu1.cpuPowerAnnualHomeEnergyCostNodeText,
              CpuPowerAnnualCommercialEnergyCostNodeText1 = cpu1.cpuPowerAnnualCommercialEnergyCostNodeText,
              CpuPowerPerformancePerWattNodeText1 = cpu1.cpuPowerPerformancePerWattNodeText,
              CpuPowerIdlePowerConsumptionNodeText1 = cpu1.cpuPowerIdlePowerConsumptionNodeText,
              CpuPowerPeakPowerConsumptionNodeText1 = cpu1.cpuPowerPeakPowerConsumptionNodeText,
              CpuPowerTypicalPowerConsumptionNodeText1 = cpu1.cpuPowerTypicalPowerConsumptionNodeText,
              CpuMemoryControllerNodeText1 = cpu1.cpuMemoryControllerNodeText,
              CpuMemoryTypeNodeText1 = cpu1.cpuMemoryTypeNodeText,
              CpuMemoryContollerChannelsNodeText1 = cpu1.cpuMemoryContollerChannelsNodeText,
              CpuMemorySupportsECCNodeText1 = cpu1.cpuMemorySupportsECCNodeText,
              CpuMemoryMaximumBandwidthNodeText1 = cpu1.cpuMemoryMaximumBandwidthNodeText,
              CpuMemoryMaximumMemorySizeNodeText1 = cpu1.cpuMemoryMaximumMemorySizeNodeText,
              CpuBusArchitectureNodeText1 = cpu1.cpuBusArchitectureNodeText,
              CpuBusNumberOfLinksNodeText1 = cpu1.cpuBusNumberOfLinksNodeText,
              CpuBusTransferRateNodeText1 = cpu1.cpuBusTransferRateNodeText,
              CpuBusDataRateNodeText1 = cpu1.cpuBusDataRateNodeText,
              CpuBusClockSpeedNodeText1 = cpu1.cpuBusClockSpeedNodeText,
              CpuMobileBenchmarkglbenchmark_2_1_egypt_offscreenNodeText1 = cpu1.cpuMobileBenchmarkglbenchmark_2_1_egypt_offscreenNodeText,
              CpuMobileBenchmarkprop_glbenchmark_2_5_egypt_classic_offscreenNodeText1 = cpu1.cpuMobileBenchmarkprop_glbenchmark_2_5_egypt_classic_offscreenNodeText,
              CpuMobileBenchmarkprop_sunspider_0_9_1NodeText1 = cpu1.cpuMobileBenchmarkprop_sunspider_0_9_1NodeText,
              CpuMobileBenchmarkprop_browsermarkNodeText1 = cpu1.cpuMobileBenchmarkprop_browsermarkNodeText,
              CpuMobileBenchmarkprop_browsermark_2NodeText1 = cpu1.cpuMobileBenchmarkprop_browsermark_2NodeText,
              CpuGeneralAnnoucedDateNodeTextSmall1 = cpu1.cpuGeneralAnnoucedDateNodeTextSmall,
              CpuGeneralExpectedDateNodeTextSmall1 = cpu1.cpuGeneralExpectedDateNodeTextSmall,
              CpuGeneralRleasedDateNodeTextSmall1 = cpu1.cpuGeneralRleasedDateNodeTextSmall,
              CpuGeneralAnnoucedDateNodeText1 = cpu1.cpuGeneralAnnoucedDateNodeText,
              CpuGeneralRleasedDateNodeText1 = cpu1.cpuGeneralRleasedDateNodeText,
              CpuGeneralExpectedDateNodeText1 = cpu1.cpuGeneralExpectedDateNodeText,
  
              CPUId2 = cpu2.cpuId,
              CPUImage2 = cpu2.cpuImageName,
              CPUImageFolder2 = cpu2.cpuImageName.Substring(0, 1),
              CpuMunafacturer2 = cpu2.cpuMunafacturer,
              CpuFamily2 = cpu2.cpuFamily,
              CpuModel2 = cpu2.cpuModel,
              CpuQuery2 = cpu2.cpuQuery,
              CpuTitle2 = cpu2.cpuQuery.Replace("-", " "),
              CpuSummaryClockSpeedNodeText2 = cpu2.cpuSummaryClockSpeedNodeText,
              CpuSummaryCoredNodeText2 = cpu2.cpuSummaryCoredNodeText,
              CpuSummaryIsUnlockedNodeText2 = cpu2.cpuSummaryIsUnlockedNodeText,
              CpuFeaturedReview2 = cpu2.cpuFeaturedReview,
              CpuFeaturedReviewLinkAndDate2 = cpu2.cpuFeaturedReviewLinkAndDate,
              CpusortMainBassScore2 = cpu2.cpuBossValueScoreNew,
              CpuOverclockingScoreNew2 = cpu2.cpuOverclockingScoreNew,
              CpuSingleCorePerformanceScoreNew2 = cpu2.cpuSingleCorePerformanceScoreNew,
              CpusortBenchmarkPerformanceScoreNew2 = cpu2.cpusortBenchmarkPerformanceScoreNew,
              CpuValueScoreNew2 = cpu2.cpuValueScoreNew,
              CpuBenchmaKX264HD4PASS1NodeText2 = cpu2.cpuBenchmaKX264HD4PASS1NodeText,
              CpuBenchmaKX264HD4PASS2NodeText2 = cpu2.cpuBenchmaKX264HD4PASS2NodeText,
              CpuBenchmaCinebenchR1032BitNodeText2 = cpu2.cpuBenchmaCinebenchR1032BitNodeText,
              CpuBenchmaCinebenchR1032Bit1CoreNodeText2 = cpu2.cpuBenchmaCinebenchR1032Bit1CoreNodeText,
              CpuBenchmarkPerformancePerDollarNodeText2 = cpu2.cpuBenchmarkPerformancePerDollarNodeText,
              CpuBenchmarkSysMark20073DNodeText2 = cpu2.cpuBenchmarkSysMark20073DNodeText,
              CpuBenchmarkSysMark2007ProductivityNodeText2 = cpu2.cpuBenchmarkSysMark2007ProductivityNodeText,
              CpuBenchmarkSysMark2007VideoCreationNodeText2 = cpu2.cpuBenchmarkSysMark2007VideoCreationNodeText,
              CpuBenchmarkCinebenchR11_5NodeText2 = cpu2.cpuBenchmarkCinebenchR11_5NodeText,
              CpuBenchmarkCinebenchR11_5_SingleNodeText2 = cpu2.cpuBenchmarkCinebenchR11_5_SingleNodeText,
              CpuBenchmark3DMark06CPUNodeText2 = cpu2.cpuBenchmark3DMark06CPUNodeText,
              CpuBenchmark3DMark11PhysicsNodeText2 = cpu2.cpuBenchmark3DMark11PhysicsNodeText,
              CpuBenchmarkPassMarkNodeText2 = cpu2.cpuBenchmarkPassMarkNodeText,
              CpuBenchmarkPassMarkSingleCoreNodeText2 = cpu2.cpuBenchmarkPassMarkSingleCoreNodeText,
              CpuBenchmarkGeekBenchNodeText2 = cpu2.cpuBenchmarkGeekBenchNodeText,
              CpuBenchmarkX264HD4NodeText2 = cpu2.cpuBenchmarkX264HD4NodeText,
              CpuBenchmarSysMark2007OverallNodeText2 = cpu2.cpuBenchmarSysMark2007OverallNodeText,
              CpuGeneralCodeNameNodeText2 = cpu2.cpuGeneralCodeNameNodeText,
              CpuGeneralMarketNodeText2 = cpu2.cpuGeneralMarketNodeText,
              CpuGeneralManuProductPageNodeText2 = cpu2.cpuGeneralManuProductPageNodeText,
              CpuSummaryTurboClockSpeedNodeText2 = cpu2.cpuSummaryTurboClockSpeedNodeText,
              CpuSummarySocketTypeNodeText2 = cpu2.cpuSummarySocketTypeNodeText,
              CpuSummaryIsHyperthreadedNodeText2 = cpu2.cpuSummaryIsHyperthreadedNodeText,
              CpuDetailsArchitectureNodeText2 = cpu2.cpuDetailsArchitectureNodeText,
              CpuDetailsThreadsNodeText2 = cpu2.cpuDetailsThreadsNodeText,
              CpuDetailsL2CacheNodeText2 = cpu2.cpuDetailsL2CacheNodeText,
              CpuDetailsL2CachePerCoreNodeText2 = cpu2.cpuDetailsL2CachePerCoreNodeText,
              CpuDetailsL3CacheNodeText2 = cpu2.cpuDetailsL3CacheNodeText,
              CpuDetailsL3CachePerCoreNodeText2 = cpu2.cpuDetailsL3CachePerCoreNodeText,
              CpuDetailsManufactureProcessNodeText2 = cpu2.cpuDetailsManufactureProcessNodeText,
              CpuDetailsTransistorCountNodeText2 = cpu2.cpuDetailsTransistorCountNodeText,
              CpuDetailsMaxCPUsNodeText2 = cpu2.cpuDetailsMaxCPUsNodeText,
              CpuDetailsClockMultiplierNodeText2 = cpu2.cpuDetailsClockMultiplierNodeText,
              CpuDetailsVoltageRangeNodeText2 = cpu2.cpuDetailsVoltageRangeNodeText,
              CpuDetailsOperatingTempNodeText2 = cpu2.cpuDetailsOperatingTempNodeText,
              CpuFeaturesNXBitNodeText2 = cpu2.cpuFeaturesNXBitNodeText,
              CpuFeaturesTrustedComputingNodeText2 = cpu2.cpuFeaturesTrustedComputingNodeText,
              CpuFeaturesVirtualizationSupportNodeText2 = cpu2.cpuFeaturesVirtualizationSupportNodeText,
              CpuFeaturesInstructionSetExtensionsNodeText2 = cpu2.cpuFeaturesInstructionSetExtensionsNodeText,
              CpuFeaturesDynamicFrequencyScalingNodeText2 = cpu2.cpuFeaturesDynamicFrequencyScalingNodeText,
              CpuOverclockingOverclockPopulartyNodeText2 = cpu2.cpuOverclockingOverclockPopulartyNodeText,
              CpuOverclockingOverclockReviewScoreNodeText2 = cpu2.cpuOverclockingOverclockReviewScoreNodeText,
              CpuOverclockingOverclockedClockSpeedNodeText2 = cpu2.cpuOverclockingOverclockedClockSpeedNodeText,
              CpuOverclockingOverclockedClockSpeedWaterNodeText2 = cpu2.cpuOverclockingOverclockedClockSpeedWaterNodeText,
              CpuOverclockingPassmarkOverclockedNodeText2 = cpu2.cpuOverclockingPassmarkOverclockedNodeText,
              CpuOverclockingOverclockedClockSpeedAirNodeText2 = cpu2.cpuOverclockingOverclockedClockSpeedAirNodeText,
              CpuGPUGpuNodeText2 = cpu2.cpuGPUGpuNodeText,
              CpuGPULabelNodeText2 = cpu2.cpuGPULabelNodeText,
              CpuGPULatestDirectXNodeText2 = cpu2.cpuGPULatestDirectXNodeText,
              CpuGPUNumberDisplaysSupportedNodeText2 = cpu2.cpuGPUNumberDisplaysSupportedNodeText,
              CpuGPUClockSpeedNodeText2 = cpu2.cpuGPUClockSpeedNodeText,
              CpuGPUTurboClockSpeedNodeText2 = cpu2.cpuGPUTurboClockSpeedNodeText,
              CpuGPU3DMark06NodeText2 = cpu2.cpuGPU3DMark06NodeText,
              CpuPowerTDPNodeText2 = cpu2.cpuPowerTDPNodeText,
              CpuPowerAnnualHomeEnergyCostNodeText2 = cpu2.cpuPowerAnnualHomeEnergyCostNodeText,
              CpuPowerAnnualCommercialEnergyCostNodeText2 = cpu2.cpuPowerAnnualCommercialEnergyCostNodeText,
              CpuPowerPerformancePerWattNodeText2 = cpu2.cpuPowerPerformancePerWattNodeText,
              CpuPowerIdlePowerConsumptionNodeText2 = cpu2.cpuPowerIdlePowerConsumptionNodeText,
              CpuPowerPeakPowerConsumptionNodeText2 = cpu2.cpuPowerPeakPowerConsumptionNodeText,
              CpuPowerTypicalPowerConsumptionNodeText2 = cpu2.cpuPowerTypicalPowerConsumptionNodeText,
              CpuMemoryControllerNodeText2 = cpu2.cpuMemoryControllerNodeText,
              CpuMemoryTypeNodeText2 = cpu2.cpuMemoryTypeNodeText,
              CpuMemoryContollerChannelsNodeText2 = cpu2.cpuMemoryContollerChannelsNodeText,
              CpuMemorySupportsECCNodeText2 = cpu2.cpuMemorySupportsECCNodeText,
              CpuMemoryMaximumBandwidthNodeText2 = cpu2.cpuMemoryMaximumBandwidthNodeText,
              CpuMemoryMaximumMemorySizeNodeText2 = cpu2.cpuMemoryMaximumMemorySizeNodeText,
              CpuBusArchitectureNodeText2 = cpu2.cpuBusArchitectureNodeText,
              CpuBusNumberOfLinksNodeText2 = cpu2.cpuBusNumberOfLinksNodeText,
              CpuBusTransferRateNodeText2 = cpu2.cpuBusTransferRateNodeText,
              CpuBusDataRateNodeText2 = cpu2.cpuBusDataRateNodeText,
              CpuBusClockSpeedNodeText2 = cpu2.cpuBusClockSpeedNodeText,
              CpuMobileBenchmarkglbenchmark_2_1_egypt_offscreenNodeText2 = cpu2.cpuMobileBenchmarkglbenchmark_2_1_egypt_offscreenNodeText,
              CpuMobileBenchmarkprop_glbenchmark_2_5_egypt_classic_offscreenNodeText2 = cpu2.cpuMobileBenchmarkprop_glbenchmark_2_5_egypt_classic_offscreenNodeText,
              CpuMobileBenchmarkprop_sunspider_0_9_1NodeText2 = cpu2.cpuMobileBenchmarkprop_sunspider_0_9_1NodeText,
              CpuMobileBenchmarkprop_browsermarkNodeText2 = cpu2.cpuMobileBenchmarkprop_browsermarkNodeText,
              CpuMobileBenchmarkprop_browsermark_2NodeText2 = cpu2.cpuMobileBenchmarkprop_browsermark_2NodeText,
              CpuGeneralAnnoucedDateNodeTextSmall2 = cpu2.cpuGeneralAnnoucedDateNodeTextSmall,
              CpuGeneralExpectedDateNodeTextSmall2 = cpu2.cpuGeneralExpectedDateNodeTextSmall,
              CpuGeneralRleasedDateNodeTextSmall2 = cpu2.cpuGeneralRleasedDateNodeTextSmall,
              CpuGeneralAnnoucedDateNodeText2 = cpu2.cpuGeneralAnnoucedDateNodeText,
              CpuGeneralRleasedDateNodeText2 = cpu2.cpuGeneralRleasedDateNodeText,
              CpuGeneralExpectedDateNodeText2 = cpu2.cpuGeneralExpectedDateNodeText
          };
      }
  </code></pre>
  
  <p>View (Used the values like this):</p>
  
  <pre><code>    @{
  if (Model.CpuGeneralRleasedDateNodeTextSmall1 != null)
  {
      if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall1)).TotalDays &lt; 31.0)
      {       
           @("Released ") @Model.CpuGeneralRleasedDateNodeText1; &lt;span class="justreleasedbadge"&gt;@("Just Released")&lt;/span&gt;
      }
      else if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall1)).TotalDays &gt; 31.0 &amp;&amp; (DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall1)).TotalDays &lt; 120.0)
      { 
           @("Released ") @Model.CpuGeneralRleasedDateNodeText1; &lt;span class="newbadge"&gt;@("New")&lt;/span&gt;
      }
      else if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall1)).TotalDays &gt; 120.0 &amp;&amp; (DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall1)).TotalDays &lt; 365.0)
      { 
          @("Released ") @Model.CpuGeneralRleasedDateNodeText1;
      }
      else if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall1)).TotalDays &gt; 365.0)
      { 
          @("Released ") @Model.CpuGeneralRleasedDateNodeText1; &lt;span class="olderbadge"&gt;@("Older")&lt;/span&gt;
      }
  
  }
  else if (Model.CpuGeneralAnnoucedDateNodeTextSmall1 != null &amp;&amp; Model.CpuGeneralRleasedDateNodeTextSmall1 == null)
  { 
            @Model.CpuGeneralAnnoucedDateNodeText1; &lt;span class="comingsoonbadge"&gt;@("Coming Soon")&lt;/span&gt; @("Annouced ")
  }
  else if (Model.CpuGeneralExpectedDateNodeTextSmall1 != null &amp;&amp; Model.CpuGeneralRleasedDateNodeTextSmall1 == null &amp;&amp; Model.CpuGeneralAnnoucedDateNodeTextSmall1 == null)
  { 
            @("First seen on ") @Model.CpuGeneralExpectedDateNodeText1; &lt;span class="rumoredbadge"&gt;@("Rumored")&lt;/span&gt;
  }
  }
  &lt;/span&gt;
  &lt;/div&gt;
  &lt;div class="comparelinkTitle"&gt;&lt;a href="@Url.Content("~/Cpu/" + @Model.CpuQuery1)"&gt;&lt;span style="font-size:20px;"&gt;@Model.CpuMunafacturer1 @Model.CpuFamily1 @Model.CpuModel1&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div class="h1small2"&gt;
  @Math.Round(Convert.ToDecimal(Model.CpuSummaryClockSpeedNodeText1), 1) GHz
  @{
  if (Model.CpuSummaryCoredNodeText1 != "Unknown")
  {
          @("| "); @Model.CpuSummaryCoredNodeText1;
  }
  }
  @{
  if (Model.CpuSummaryIsUnlockedNodeText1 != "Unknown")
  {
      if (Model.CpuSummaryIsUnlockedNodeText1 == "Yes")
      {
              @(" | Unlocked");
      }
      else
      {
              @("");
      }
  }
  }
  &lt;/div&gt;
  &lt;div id="pnlContainer" style="text-align:right"&gt;
  &lt;a href="@Url.Content("~/Cpu/" + @Model.CpuQuery1)"&gt;&lt;img alt="@Model.CpuMunafacturer1 @Model.CpuFamily1 @Model.CpuModel1" class="imgclass3" style="max-width:370px" src="http://img.cpusort.com/@Model.CPUImageFolder1/@Model.CPUImage1" /&gt;&lt;/a&gt;
  @if (Model.CpusortMainBassScore1 != 0 &amp;&amp; Model.CpusortMainBassScore2 != 0 &amp;&amp; Model.CpuGeneralMarketNodeText1 != "Mobile" &amp;&amp; Model.CpuGeneralMarketNodeText2 != "Mobile")
  {
  &lt;div class="dragDiv" style="right:0px" id="dragDiv"&gt;
  &lt;span class="scoretextsmall"&gt;@Math.Round(Convert.ToDecimal(Model.CpusortMainBassScore1), 1)&lt;/span&gt;
  &lt;span class="scoreunits" style="color:#fff"&gt;Out of 10&lt;/span&gt;
  &lt;/div&gt;
  }
  else if (Model.CpusortMainBassScore1 != 0 &amp;&amp; Model.CpusortMainBassScore2 != 0 &amp;&amp; Model.CpuGeneralMarketNodeText1 == "Mobile" &amp;&amp; Model.CpuGeneralMarketNodeText2 == "Mobile")
  {
  &lt;div class="dragDiv" style="right:0px" id="dragDiv"&gt;
  &lt;span class="scoretextsmall"&gt;@Math.Round(Convert.ToDecimal(Model.CpusortMainBassScore1), 1)&lt;/span&gt;
  &lt;span class="scoreunits" style="color:#fff"&gt;Out of 10&lt;/span&gt;
  &lt;/div&gt;
  }
  &lt;/div&gt;
  @if (Model.CpuFeaturedReview1 != null)
  {
  &lt;blockquote&gt;@Model.CpuFeaturedReview1&lt;/blockquote&gt;
  &lt;span style="padding-left:18px;"&gt;@Html.Raw(Model.CpuFeaturedReviewLinkAndDate1)&lt;/span&gt;
  }
  &lt;/td&gt;
  &lt;td style="width:50%; padding:0px 0px 10px 20px; text-align:left;"&gt;
  &lt;div style="float:right"&gt;
  &lt;span class="comparesmall" style="vertical-align:middle" &gt;
  @{
  if (Model.CpuGeneralRleasedDateNodeTextSmall2 != null)
  {
      if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall2)).TotalDays &lt; 31.0)
      {       
           &lt;span class="justreleasedbadge"&gt;@("Just Released")&lt;/span&gt; @("Released") @Model.CpuGeneralRleasedDateNodeText2;
      }
      else if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall2)).TotalDays &gt; 31.0 &amp;&amp; (DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall2)).TotalDays &lt; 120.0)
      { 
           &lt;span class="newbadge"&gt;@("New")&lt;/span&gt; @("Released ") @Model.CpuGeneralRleasedDateNodeText2;
      }
      else if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall2)).TotalDays &gt; 120.0 &amp;&amp; (DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall2)).TotalDays &lt; 365.0)
      { 
          @("Released ") @Model.CpuGeneralRleasedDateNodeText2;
      }
      else if ((DateTime.UtcNow - Convert.ToDateTime(Model.CpuGeneralRleasedDateNodeTextSmall2)).TotalDays &gt; 365.0)
      { 
          &lt;span class="olderbadge"&gt;@("Older")&lt;/span&gt; @("Released ") @Model.CpuGeneralRleasedDateNodeText2;
      }
  
  }
  else if (Model.CpuGeneralAnnoucedDateNodeTextSmall2 != null &amp;&amp; Model.CpuGeneralRleasedDateNodeTextSmall2 == null)
  { 
           &lt;span class="comingsoonbadge"&gt;@("Coming Soon")&lt;/span&gt; @("Annouced ") @Model.CpuGeneralAnnoucedDateNodeText2;
  }
  else if (Model.CpuGeneralExpectedDateNodeTextSmall2 != null &amp;&amp; Model.CpuGeneralRleasedDateNodeTextSmall2 == null &amp;&amp; Model.CpuGeneralAnnoucedDateNodeTextSmall2 == null)
  { 
           &lt;span class="rumoredbadge"&gt;@("Rumored")&lt;/span&gt; @("First seen on ") @Model.CpuGeneralExpectedDateNodeText2;
  }
  }
  &lt;/span&gt;
  &lt;/div&gt;
  &lt;div class="comparelinkTitle"&gt;&lt;a href="@Url.Content("~/Cpu/" + @Model.CpuQuery2)"&gt;&lt;span style="font-size:20px; line-height:22px"&gt;@Model.CpuMunafacturer2 @Model.CpuFamily2 @Model.CpuModel2&lt;/span&gt;&lt;/a&gt;&lt;/div&gt; 
  &lt;div class="h1small2"&gt;
  @Math.Round(Convert.ToDecimal(Model.CpuSummaryClockSpeedNodeText2), 1) GHz
  @{
  if (Model.CpuSummaryCoredNodeText2 != "Unknown")
  {
          @("| "); @Model.CpuSummaryCoredNodeText2;
  }
  }
  @{
  if (Model.CpuSummaryIsUnlockedNodeText2 != "Unknown")
  {
      if (Model.CpuSummaryIsUnlockedNodeText2 == "Yes")
      {
              @(" | Unlocked");
      }
      else
      {
              @("");
      }
  }
  }
  &lt;/div&gt;
  &lt;div id="pnlContainer" style="text-align:left"&gt;
  &lt;a href="@Url.Content("~/Cpu/" + @Model.CpuQuery2)"&gt;&lt;img alt="@Model.CpuMunafacturer2 @Model.CpuFamily2 @Model.CpuModel2" class="imgclass2" style="max-width:370px" src="http://img.cpusort.com/@Model.CPUImageFolder2/@Model.CPUImage2" /&gt;&lt;/a&gt;
  @if (Model.CpusortMainBassScore1 != 0 &amp;&amp; Model.CpusortMainBassScore2 != 0 &amp;&amp; Model.CpuGeneralMarketNodeText1 != "Mobile" &amp;&amp; Model.CpuGeneralMarketNodeText2 != "Mobile")
  {
  &lt;div class="dragDiv" style="left:0px" id="dragDiv"&gt;
  &lt;span class="scoretextsmall"&gt;@Math.Round(Convert.ToDecimal(Model.CpusortMainBassScore2), 1)&lt;/span&gt;
  &lt;span class="scoreunits" style="color:#fff"&gt;Out of 10&lt;/span&gt;
  &lt;/div&gt;
  }
  else if (Model.CpusortMainBassScore1 != 0 &amp;&amp; Model.CpusortMainBassScore2 != 0 &amp;&amp; Model.CpuGeneralMarketNodeText1 == "Mobile" &amp;&amp; Model.CpuGeneralMarketNodeText2 == "Mobile")
  {
  &lt;div class="dragDiv" style="left:0px" id="dragDiv"&gt;
  &lt;span class="scoretextsmall"&gt;@Math.Round(Convert.ToDecimal(Model.CpusortMainBassScore2), 1)&lt;/span&gt;
  &lt;span class="scoreunits" style="color:#fff"&gt;Out of 10&lt;/span&gt;
  &lt;/div&gt;
  }
  &lt;/div&gt;
  @if (Model.CpuFeaturedReview2 != null)
  {
  &lt;blockquote&gt;@Model.CpuFeaturedReview2&lt;/blockquote&gt;
  &lt;span style="padding-left:18px;"&gt;@Html.Raw(Model.CpuFeaturedReviewLinkAndDate2)&lt;/span&gt;
  }
  &lt;/td&gt;
  }
  </code></pre>