IsLeaked Property added, GetWin10Labs API

Also support multi-line source detail fields.
This commit is contained in:
Thomas Hounsell 2014-10-27 10:14:31 +00:00
parent c625bc2a05
commit 38e54126ee
4 changed files with 40 additions and 1 deletions

View File

@ -219,6 +219,7 @@
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Areas\admin\Models\" /> <Folder Include="Areas\admin\Models\" />
<Folder Include="Areas\admin\Views\Shared\" /> <Folder Include="Areas\admin\Views\Shared\" />
<Folder Include="Models\ApiModel\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="packages.config" /> <Content Include="packages.config" />

View File

@ -14,5 +14,10 @@ public IEnumerable<Build> GetBuilds()
{ {
return Build.SelectInBuildOrder(); return Build.SelectInBuildOrder();
} }
public IEnumerable<string> GetWin10Labs()
{
return Build.SelectBuildLabs(6, 4);
}
} }
} }

View File

@ -81,6 +81,22 @@ public class Build : IHasId<long>
[EnumDataType(typeof(LevelOfFlight))] [EnumDataType(typeof(LevelOfFlight))]
public LevelOfFlight FlightLevel { get; set; } public LevelOfFlight FlightLevel { get; set; }
public bool IsLeaked
{
get
{
switch(SourceType)
{
case TypeOfSource.PublicRelease:
case TypeOfSource.InternalLeak:
case TypeOfSource.UpdateGDR:
return true;
default:
return false;
}
}
}
public string FullBuildString public string FullBuildString
{ {
get get
@ -186,6 +202,23 @@ public static IEnumerable<string> SelectBuildLabs()
} }
} }
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static IEnumerable<string> SelectBuildLabs(byte major, byte minor)
{
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
{
var client = rClient.As<Build>();
var results = client.GetAll()
.Where(b => !string.IsNullOrWhiteSpace(b.Lab))
.Where(b => b.MajorVersion == major)
.Where(b => b.MinorVersion == minor)
.GroupBy(b => b.Lab.ToLower())
.Select(b => b.First().Lab.ToLower())
.OrderBy(s => s);
return results;
}
}
[DataObjectMethod(DataObjectMethodType.Insert, true)] [DataObjectMethod(DataObjectMethodType.Insert, true)]
public static void Insert(Build item) public static void Insert(Build item)
{ {

View File

@ -71,7 +71,7 @@
<div class="form-group"> <div class="form-group">
@Html.LabelFor(model => model.SourceDetails, new { @class = "control-label col-sm-2" }) @Html.LabelFor(model => model.SourceDetails, new { @class = "control-label col-sm-2" })
<div class="col-sm-10"> <div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.SourceDetails)</p> <p class="form-control-static">@Html.Raw(Html.DisplayFor(model => model.SourceDetails).ToHtmlString().Replace("\r\n", "<br />"))</p>
</div> </div>
</div> </div>