mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Burn everything
This is where I NOP all the methods. Also start re-implementing the data layer.
This commit is contained in:
parent
dee8385e8d
commit
48e161ca4a
|
@ -750,11 +750,11 @@
|
|||
</Compile>
|
||||
<Compile Include="Models\ApiModel\NewBuild.cs" />
|
||||
<Compile Include="Models\ApiModel\SearchResult.cs" />
|
||||
<Compile Include="Models\Build\Build-Group.cs" />
|
||||
<Compile Include="Models\Build\Build-Source.cs" />
|
||||
<Compile Include="Models\Build\Build-Version.cs" />
|
||||
<Compile Include="Models\Build\Build-Year.cs" />
|
||||
<Compile Include="Models\Build\Build-Lab.cs" />
|
||||
<Compile Include="Models\Build\Build-Version.cs" />
|
||||
<Compile Include="Models\Build\Build-Group.cs" />
|
||||
<Compile Include="Models\Build\Build.cs" />
|
||||
<Compile Include="Models\Build\BuildGroup.cs" />
|
||||
<Compile Include="Models\Build\BuildModel.cs" />
|
||||
|
@ -882,7 +882,7 @@
|
|||
<Content Include="Views\_ViewStart.cshtml" />
|
||||
<Content Include="Views\shared\error.cshtml" />
|
||||
<Content Include="Views\shared\_default.cshtml" />
|
||||
<Content Include="Views\front\editBuild.cshtml" />
|
||||
<Content Include="Views\front\EditBuild.cshtml" />
|
||||
<Content Include="Views\shared\DisplayTemplates\Enumeration.cshtml" />
|
||||
<Content Include="Views\support\register.cshtml" />
|
||||
<Content Include="Views\support\login.cshtml" />
|
||||
|
@ -895,9 +895,9 @@
|
|||
<Content Include="smtp.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\front\index.cshtml" />
|
||||
<Content Include="Views\front\Index.cshtml" />
|
||||
<Content Include="Views\front\viewGroup.cshtml" />
|
||||
<Content Include="Views\front\viewBuild.cshtml" />
|
||||
<Content Include="Views\front\ViewBuild.cshtml" />
|
||||
<Content Include="Views\front\viewLab.cshtml" />
|
||||
<Content Include="Views\front\viewSource.cshtml" />
|
||||
<Content Include="Views\front\viewYear.cshtml" />
|
||||
|
|
|
@ -22,19 +22,20 @@ public apiController() : base()
|
|||
|
||||
public async Task<BuildModel[]> GetBuilds(int limit = 20, int skip = 0)
|
||||
{
|
||||
var builds = await bModel.SelectInBuildOrder(limit, skip);
|
||||
return builds.ToArray();
|
||||
throw new NotImplementedException();
|
||||
// var builds = await bModel.SelectInBuildOrder(limit, skip);
|
||||
// return builds.ToArray();
|
||||
}
|
||||
|
||||
public async Task<FrontBuildGroup[]> GetBuildGroups(int limit = 20, int skip = 20)
|
||||
{
|
||||
var bgroups = await bModel.SelectBuildGroups(limit, skip);
|
||||
var bgroups = await bModel.SelectAllGroups(limit, skip);
|
||||
return bgroups.ToArray();
|
||||
}
|
||||
|
||||
public async Task<BuildModel[]> GetBuildsForBuildGroup(uint major, uint minor, uint number, uint? revision = null)
|
||||
{
|
||||
var builds = await bModel.SelectBuildGroup(new BuildGroup()
|
||||
var builds = await bModel.SelectGroup(new BuildGroup()
|
||||
{
|
||||
Major = major,
|
||||
Minor = minor,
|
||||
|
@ -42,20 +43,21 @@ public async Task<BuildModel[]> GetBuildsForBuildGroup(uint major, uint minor, u
|
|||
Revision = revision
|
||||
});
|
||||
|
||||
return builds.Item2.ToArray();
|
||||
return builds.ToArray();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<string>> GetWin10Labs()
|
||||
{
|
||||
List<string> labs = new List<string>();
|
||||
labs.AddRange(await bModel.SelectLabs(6, 4));
|
||||
labs.AddRange(await bModel.SelectLabs(10, 0));
|
||||
throw new NotImplementedException();
|
||||
//List<string> labs = new List<string>();
|
||||
//labs.AddRange(await bModel.SelectLabs(6, 4));
|
||||
//labs.AddRange(await bModel.SelectLabs(10, 0));
|
||||
|
||||
return labs
|
||||
.GroupBy(l => l)
|
||||
.Select(l => l.Key)
|
||||
.Where(l => l.All(c => c != '('))
|
||||
.ToArray();
|
||||
//return labs
|
||||
// .GroupBy(l => l)
|
||||
// .Select(l => l.Key)
|
||||
// .Where(l => l.All(c => c != '('))
|
||||
// .ToArray();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -99,7 +101,7 @@ where s.Text.ToLower().Contains(id.ToLower())
|
|||
orderby s.Text.ToLower().IndexOf(id.ToLower(), StringComparison.Ordinal) ascending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Source Root", new { controller = "front", action = "viewSource", source = s.Value }),
|
||||
Url = Url.Route("Source Root", new { controller = "Front", action = "ViewSource", source = s.Value }),
|
||||
Label = s.Text.Replace(id, "<strong>" + id + "</strong>"),
|
||||
Title = s.Text,
|
||||
Group = Common.SearchSource
|
||||
|
@ -108,12 +110,12 @@ orderby s.Text.ToLower().IndexOf(id.ToLower(), StringComparison.Ordinal) ascendi
|
|||
results.AddRange(sourceResults);
|
||||
|
||||
|
||||
var versionResults = from v in await bModel.SelectVersions()
|
||||
var versionResults = from v in await bModel.SelectAllVersions()
|
||||
where $"{v.Major}.{v.Minor}".StartsWith(id)
|
||||
orderby v.Major descending, v.Minor descending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Version Root", new { controller = "front", action = "viewVersion", major = v.Major, minor = v.Minor }),
|
||||
Url = Url.Route("Version Root", new { controller = "Front", action = "ViewVersion", major = v.Major, minor = v.Minor }),
|
||||
Label = $"{v.Major}.{v.Minor}".Replace(id, "<strong>" + id + "</strong>"),
|
||||
Title = "",
|
||||
Group = Common.SearchVersion
|
||||
|
@ -122,12 +124,12 @@ orderby s.Text.ToLower().IndexOf(id.ToLower(), StringComparison.Ordinal) ascendi
|
|||
results.AddRange(versionResults);
|
||||
|
||||
|
||||
var yearResults = from y in await bModel.SelectYears()
|
||||
var yearResults = from y in await bModel.SelectAllYears()
|
||||
where y.ToString().Contains(id)
|
||||
orderby y descending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Year Root", new { controller = "front", action = "viewYear", year = y }),
|
||||
Url = Url.Route("Year Root", new { controller = "Front", action = "ViewYear", year = y }),
|
||||
Label = y.ToString().Replace(id, "<strong>" + id + "</strong>"),
|
||||
Title = "",
|
||||
Group = Common.SearchYear
|
||||
|
@ -136,18 +138,18 @@ orderby y descending
|
|||
results.AddRange(yearResults);
|
||||
|
||||
|
||||
var labResults = from l in await bModel.SearchBuildLabs(id)
|
||||
orderby l.IndexOf(id.ToLower()) ascending,
|
||||
l.Length ascending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Lab Root", new { controller = "front", action = "viewLab", lab = l.Replace('/', '-') }),
|
||||
Label = l.Replace(id, $"<strong>{id}</strong>"),
|
||||
Title = l,
|
||||
Group = Common.SearchLab
|
||||
};
|
||||
//var labResults = from l in await bModel.SearchBuildLabs(id)
|
||||
// orderby l.IndexOf(id.ToLower()) ascending,
|
||||
// l.Length ascending
|
||||
// select new SearchResult()
|
||||
// {
|
||||
// Url = Url.Route("Lab Root", new { controller = "Front", action = "ViewLab", lab = l.Replace('/', '-') }),
|
||||
// Label = l.Replace(id, $"<strong>{id}</strong>"),
|
||||
// Title = l,
|
||||
// Group = Common.SearchLab
|
||||
// };
|
||||
|
||||
results.AddRange(labResults);
|
||||
//results.AddRange(labResults);
|
||||
|
||||
|
||||
var buildResults = from b in await bModel.Select()
|
||||
|
@ -156,7 +158,7 @@ orderby b.FullBuildString.ToLower().IndexOf(id.ToLower(), StringComparison.Ordin
|
|||
b.BuildTime descending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Build", new { controller = "front", action = "viewBuild", id = b.Id }),
|
||||
Url = Url.Route("Build", new { controller = "Front", action = "ViewBuild", id = b.Id }),
|
||||
Label = b.FullBuildString.Replace(id, $"<strong>{id}</strong>"),
|
||||
Title = b.FullBuildString,
|
||||
Group = Common.SearchBuild
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using BuildFeed.Code;
|
||||
using BuildFeed.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
@ -9,40 +10,39 @@
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class frontController : LocalController
|
||||
public class FrontController : LocalController
|
||||
{
|
||||
public const int PAGE_SIZE = 96;
|
||||
private const int PAGE_SIZE = 96;
|
||||
|
||||
private Build bModel;
|
||||
private MetaItem mModel;
|
||||
private readonly Build _bModel;
|
||||
private readonly MetaItem _mModel;
|
||||
|
||||
public frontController() : base()
|
||||
public FrontController() : base()
|
||||
{
|
||||
bModel = new Build();
|
||||
mModel = new MetaItem();
|
||||
_bModel = new Build();
|
||||
_mModel = new MetaItem();
|
||||
}
|
||||
|
||||
[Route("", Order = 1)]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> index() { return await indexPage(1); }
|
||||
public async Task<ActionResult> Index() { return await IndexPage(1); }
|
||||
|
||||
[Route("page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> indexPage(int page)
|
||||
public async Task<ActionResult> IndexPage(int page)
|
||||
{
|
||||
var buildGroups = await bModel.SelectBuildGroups(PAGE_SIZE, (page - 1) * PAGE_SIZE);
|
||||
var buildGroups = await _bModel.SelectAllGroups(PAGE_SIZE, (page - 1) * PAGE_SIZE);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(
|
||||
Convert.ToDouble(await bModel.SelectBuildGroupsCount()) /
|
||||
Convert.ToDouble(await _bModel.SelectAllGroupsCount()) /
|
||||
Convert.ToDouble(PAGE_SIZE));
|
||||
|
||||
if (ViewBag.PageNumber > ViewBag.PageCount)
|
||||
|
@ -50,45 +50,47 @@ public async Task<ActionResult> indexPage(int page)
|
|||
return new HttpNotFoundResult();
|
||||
}
|
||||
|
||||
return View("index", buildGroups);
|
||||
return View("Index", buildGroups);
|
||||
}
|
||||
|
||||
[Route("group/{major}.{minor}.{number}.{revision}/")]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewGroup(uint major, uint minor, uint number, uint? revision = null)
|
||||
public async Task<ActionResult> ViewGroup(uint major, uint minor, uint number, uint? revision = null)
|
||||
{
|
||||
var builds = await bModel.SelectBuildGroup(new BuildGroup()
|
||||
{
|
||||
Major = major,
|
||||
Minor = minor,
|
||||
Build = number,
|
||||
Revision = revision
|
||||
});
|
||||
BuildGroup bg = new BuildGroup()
|
||||
{
|
||||
Major = major,
|
||||
Minor = minor,
|
||||
Build = number,
|
||||
Revision = revision
|
||||
};
|
||||
|
||||
return builds.Item2.Count() == 1 ?
|
||||
RedirectToAction("viewBuild", new { id = builds.Item2.Single().Id }) as ActionResult :
|
||||
View(builds);
|
||||
var builds = await _bModel.SelectGroup(bg);
|
||||
|
||||
return builds.Count() == 1 ?
|
||||
RedirectToAction(nameof(ViewBuild), new { id = builds.Single().Id }) as ActionResult :
|
||||
View(new Tuple<BuildGroup, List<BuildModel>>(bg, builds));
|
||||
}
|
||||
|
||||
[Route("build/{id:guid}/", Name = "Build")]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewBuild(Guid id)
|
||||
public async Task<ActionResult> ViewBuild(Guid id)
|
||||
{
|
||||
BuildModel b = await bModel.SelectById(id);
|
||||
BuildModel b = await _bModel.SelectById(id);
|
||||
if (b == null) return new HttpNotFoundResult();
|
||||
return View(b);
|
||||
}
|
||||
|
||||
[Route("build/{id:long}/", Name = "Build (Legacy)")]
|
||||
public async Task<ActionResult> viewBuild(long id)
|
||||
public async Task<ActionResult> ViewBuild(long id)
|
||||
{
|
||||
BuildModel b = await bModel.SelectByLegacyId(id);
|
||||
BuildModel b = await _bModel.SelectByLegacyId(id);
|
||||
if (b == null) return new HttpNotFoundResult();
|
||||
return RedirectToAction("viewBuild", new { id = b.Id });
|
||||
return RedirectToAction(nameof(ViewBuild), new { id = b.Id });
|
||||
}
|
||||
|
||||
[Route("twitter/{id:guid}/", Name = "Twitter")]
|
||||
|
@ -96,9 +98,9 @@ public async Task<ActionResult> viewBuild(long id)
|
|||
[OutputCache(Duration = 600, VaryByParam = "none")]
|
||||
[CustomContentType(ContentType = "image/png", Order = 2)]
|
||||
#endif
|
||||
public async Task<ActionResult> twitterCard(Guid id)
|
||||
public async Task<ActionResult> TwitterCard(Guid id)
|
||||
{
|
||||
BuildModel b = await bModel.SelectById(id);
|
||||
BuildModel b = await _bModel.SelectById(id);
|
||||
if (b == null) return new HttpNotFoundResult();
|
||||
|
||||
string path = Path.Combine(Server.MapPath("~/content/card/"), $"{b.Family}.png");
|
||||
|
@ -136,36 +138,36 @@ public async Task<ActionResult> twitterCard(Guid id)
|
|||
}
|
||||
|
||||
[Route("twitter/{id:long}/", Name = "Twitter (Legacy)")]
|
||||
public async Task<ActionResult> twitterCard(long id)
|
||||
public async Task<ActionResult> TwitterCard(long id)
|
||||
{
|
||||
BuildModel b = await bModel.SelectByLegacyId(id);
|
||||
BuildModel b = await _bModel.SelectByLegacyId(id);
|
||||
if (b == null) return new HttpNotFoundResult();
|
||||
return RedirectToAction("twitterCard", new { id = b.Id });
|
||||
return RedirectToAction(nameof(TwitterCard), new { id = b.Id });
|
||||
}
|
||||
|
||||
[Route("lab/{lab}/", Order = 1, Name = "Lab Root")]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewLab(string lab) { return await viewLabPage(lab, 1); }
|
||||
public async Task<ActionResult> ViewLab(string lab) { return await ViewLabPage(lab, 1); }
|
||||
|
||||
[Route("lab/{lab}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewLabPage(string lab, int page)
|
||||
public async Task<ActionResult> ViewLabPage(string lab, int page)
|
||||
{
|
||||
ViewBag.MetaItem = await mModel.SelectById(new MetaItemKey
|
||||
ViewBag.MetaItem = await _mModel.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Lab,
|
||||
Value = lab
|
||||
});
|
||||
|
||||
var builds = await bModel.SelectLab(lab, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
var builds = await _bModel.SelectLab(lab, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
ViewBag.ItemId = builds.First().Lab;
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(await bModel.SelectLabCount(lab)) / Convert.ToDouble(PAGE_SIZE));
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(await _bModel.SelectLabCount(lab)) / Convert.ToDouble(PAGE_SIZE));
|
||||
|
||||
if (ViewBag.PageNumber > ViewBag.PageCount)
|
||||
{
|
||||
|
@ -179,25 +181,25 @@ public async Task<ActionResult> viewLabPage(string lab, int page)
|
|||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewSource(TypeOfSource source) { return await viewSourcePage(source, 1); }
|
||||
public async Task<ActionResult> ViewSource(TypeOfSource source) { return await ViewSourcePage(source, 1); }
|
||||
|
||||
[Route("source/{source}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewSourcePage(TypeOfSource source, int page)
|
||||
public async Task<ActionResult> ViewSourcePage(TypeOfSource source, int page)
|
||||
{
|
||||
ViewBag.MetaItem = await mModel.SelectById(new MetaItemKey
|
||||
ViewBag.MetaItem = await _mModel.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Source,
|
||||
Value = source.ToString()
|
||||
});
|
||||
ViewBag.ItemId = DisplayHelpers.GetDisplayTextForEnum(source);
|
||||
|
||||
var builds = await bModel.SelectSource(source, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
var builds = await _bModel.SelectSource(source, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(await bModel.SelectSourceCount(source)) / Convert.ToDouble(PAGE_SIZE));
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(await _bModel.SelectSourceCount(source)) / Convert.ToDouble(PAGE_SIZE));
|
||||
|
||||
if (ViewBag.PageNumber > ViewBag.PageCount)
|
||||
{
|
||||
|
@ -211,25 +213,25 @@ public async Task<ActionResult> viewSourcePage(TypeOfSource source, int page)
|
|||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewYear(int year) { return await viewYearPage(year, 1); }
|
||||
public async Task<ActionResult> ViewYear(int year) { return await ViewYearPage(year, 1); }
|
||||
|
||||
[Route("year/{year}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewYearPage(int year, int page)
|
||||
public async Task<ActionResult> ViewYearPage(int year, int page)
|
||||
{
|
||||
ViewBag.MetaItem = await mModel.SelectById(new MetaItemKey
|
||||
ViewBag.MetaItem = await _mModel.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Year,
|
||||
Value = year.ToString()
|
||||
});
|
||||
ViewBag.ItemId = year.ToString();
|
||||
|
||||
var builds = await bModel.SelectYear(year, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
var builds = await _bModel.SelectYear(year, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(await bModel.SelectYearCount(year) / Convert.ToDouble(PAGE_SIZE));
|
||||
ViewBag.PageCount = Math.Ceiling(await _bModel.SelectYearCount(year) / Convert.ToDouble(PAGE_SIZE));
|
||||
|
||||
if (ViewBag.PageNumber > ViewBag.PageCount)
|
||||
{
|
||||
|
@ -243,26 +245,26 @@ public async Task<ActionResult> viewYearPage(int year, int page)
|
|||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewVersion(uint major, uint minor) { return await viewVersionPage(major, minor, 1); }
|
||||
public async Task<ActionResult> ViewVersion(uint major, uint minor) { return await ViewVersionPage(major, minor, 1); }
|
||||
|
||||
[Route("version/{major}.{minor}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public async Task<ActionResult> viewVersionPage(uint major, uint minor, int page)
|
||||
public async Task<ActionResult> ViewVersionPage(uint major, uint minor, int page)
|
||||
{
|
||||
string valueString = $"{major}.{minor}";
|
||||
ViewBag.MetaItem = await mModel.SelectById(new MetaItemKey
|
||||
ViewBag.MetaItem = await _mModel.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Version,
|
||||
Value = valueString
|
||||
});
|
||||
ViewBag.ItemId = valueString;
|
||||
|
||||
var builds = await bModel.SelectVersion(major, minor, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
var builds = await _bModel.SelectVersion(major, minor, (page - 1) * PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(await bModel.SelectVersionCount(major, minor)) / Convert.ToDouble(PAGE_SIZE));
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(await _bModel.SelectVersionCount(major, minor)) / Convert.ToDouble(PAGE_SIZE));
|
||||
|
||||
if (ViewBag.PageNumber > ViewBag.PageCount)
|
||||
{
|
||||
|
@ -273,18 +275,18 @@ public async Task<ActionResult> viewVersionPage(uint major, uint minor, int page
|
|||
}
|
||||
|
||||
[Route("add/"), Authorize]
|
||||
public ActionResult addBuild()
|
||||
public ActionResult AddBuild()
|
||||
{
|
||||
BuildModel b = new BuildModel()
|
||||
{
|
||||
SourceType = TypeOfSource.PrivateLeak,
|
||||
FlightLevel = LevelOfFlight.None
|
||||
};
|
||||
return View("editBuild", b);
|
||||
return View("EditBuild", b);
|
||||
}
|
||||
|
||||
[Route("add/"), Authorize, HttpPost]
|
||||
public async Task<ActionResult> addBuild(BuildModel build)
|
||||
public async Task<ActionResult> AddBuild(BuildModel build)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
|
@ -300,29 +302,29 @@ public async Task<ActionResult> addBuild(BuildModel build)
|
|||
{
|
||||
build.LeakDate = DateTime.SpecifyKind(build.LeakDate.Value, DateTimeKind.Utc);
|
||||
}
|
||||
await bModel.Insert(build);
|
||||
await _bModel.Insert(build);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View("editBuild", build);
|
||||
return View("EditBuild", build);
|
||||
}
|
||||
return RedirectToAction("viewBuild", new
|
||||
return RedirectToAction(nameof(ViewBuild), new
|
||||
{
|
||||
id = build.Id
|
||||
});
|
||||
}
|
||||
return View("editBuild", build);
|
||||
return View("EditBuild", build);
|
||||
}
|
||||
|
||||
[Route("edit/{id}/"), Authorize]
|
||||
public async Task<ActionResult> editBuild(Guid id)
|
||||
public async Task<ActionResult> EditBuild(Guid id)
|
||||
{
|
||||
BuildModel b = await bModel.SelectById(id);
|
||||
BuildModel b = await _bModel.SelectById(id);
|
||||
return View(b);
|
||||
}
|
||||
|
||||
[Route("edit/{id}/"), Authorize, HttpPost]
|
||||
public async Task<ActionResult> editBuild(Guid id, BuildModel build)
|
||||
public async Task<ActionResult> EditBuild(Guid id, BuildModel build)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
|
@ -336,23 +338,23 @@ public async Task<ActionResult> editBuild(Guid id, BuildModel build)
|
|||
{
|
||||
build.LeakDate = DateTime.SpecifyKind(build.LeakDate.Value, DateTimeKind.Utc);
|
||||
}
|
||||
await bModel.Update(build);
|
||||
await _bModel.Update(build);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View(build);
|
||||
}
|
||||
|
||||
return RedirectToAction("viewBuild", new { id = build.Id });
|
||||
return RedirectToAction(nameof(ViewBuild), new { id = build.Id });
|
||||
}
|
||||
return View(build);
|
||||
}
|
||||
|
||||
[Route("delete/{id}/"), Authorize(Roles = "Administrators")]
|
||||
public async Task<ActionResult> deleteBuild(Guid id)
|
||||
public async Task<ActionResult> DeleteBuild(Guid id)
|
||||
{
|
||||
await bModel.DeleteById(id);
|
||||
return RedirectToAction("index");
|
||||
await _bModel.DeleteById(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using BuildFeed.Code;
|
||||
using System;
|
||||
using BuildFeed.Code;
|
||||
using BuildFeed.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -24,225 +25,231 @@ public rssController() : base()
|
|||
[Route("rss/compiled")]
|
||||
public async Task<ActionResult> index()
|
||||
{
|
||||
var builds = await bModel.SelectInBuildOrder(RSS_SIZE, 0);
|
||||
throw new NotImplementedException();
|
||||
//var builds = await bModel.SelectInBuildOrder(RSS_SIZE, 0);
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Compiled",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
//RssDocument rdoc = new RssDocument()
|
||||
//{
|
||||
// Channel = new RssChannel()
|
||||
// {
|
||||
// Title = "BuildFeed RSS - Recently Compiled",
|
||||
// Description = "",
|
||||
// Generator = "BuildFeed.net RSS Controller",
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
// SkipHours = new List<Hour>(),
|
||||
// SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
|
||||
Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("viewBuild", new { controller = "front", id = build.Id })) },
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
// Items = (from build in builds
|
||||
// select new RssItem()
|
||||
// {
|
||||
// Title = build.FullBuildString,
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"),
|
||||
// Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("viewBuild", new { controller = "Front", id = build.Id })) },
|
||||
// }).ToList()
|
||||
// }
|
||||
//};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
//Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
//await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
//return new EmptyResult();
|
||||
}
|
||||
|
||||
[Route("rss/added")]
|
||||
public async Task<ActionResult> added()
|
||||
{
|
||||
var builds = await bModel.SelectLatest(RSS_SIZE, 0);
|
||||
throw new NotImplementedException();
|
||||
//var builds = await bModel.SelectLatest(RSS_SIZE, 0);
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Added",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
//RssDocument rdoc = new RssDocument()
|
||||
//{
|
||||
// Channel = new RssChannel()
|
||||
// {
|
||||
// Title = "BuildFeed RSS - Recently Added",
|
||||
// Description = "",
|
||||
// Generator = "BuildFeed.net RSS Controller",
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
// SkipHours = new List<Hour>(),
|
||||
// SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
|
||||
Guid = new RssGuid()
|
||||
{
|
||||
IsPermaLink = true,
|
||||
Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"
|
||||
},
|
||||
Category = new RssCategory() { Text = build.Family.ToString() },
|
||||
InternalPubDate = new RssDate(build.Added).DateStringISO8601 // bit of a dirty hack to work around problem in X.Web.RSS with the date format.
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
// Items = (from build in builds
|
||||
// select new RssItem()
|
||||
// {
|
||||
// Title = build.FullBuildString,
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"),
|
||||
// Guid = new RssGuid()
|
||||
// {
|
||||
// IsPermaLink = true,
|
||||
// Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"
|
||||
// },
|
||||
// Category = new RssCategory() { Text = build.Family.ToString() },
|
||||
// InternalPubDate = new RssDate(build.Added).DateStringISO8601 // bit of a dirty hack to work around problem in X.Web.RSS with the date format.
|
||||
// }).ToList()
|
||||
// }
|
||||
//};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
//Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
//await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
//return new EmptyResult();
|
||||
}
|
||||
|
||||
[Route("rss/leaked")]
|
||||
public async Task<ActionResult> leaked()
|
||||
{
|
||||
var builds = await bModel.SelectLatestLeaked(RSS_SIZE, 0);
|
||||
throw new NotImplementedException();
|
||||
//var builds = await bModel.SelectLatestLeaked(RSS_SIZE, 0);
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Leaked",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
//RssDocument rdoc = new RssDocument()
|
||||
//{
|
||||
// Channel = new RssChannel()
|
||||
// {
|
||||
// Title = "BuildFeed RSS - Recently Leaked",
|
||||
// Description = "",
|
||||
// Generator = "BuildFeed.net RSS Controller",
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
// SkipHours = new List<Hour>(),
|
||||
// SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
|
||||
Guid = new RssGuid()
|
||||
{
|
||||
IsPermaLink = true,
|
||||
Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"
|
||||
},
|
||||
InternalPubDate = new RssDate(build.LeakDate.Value).DateStringISO8601 // bit of a dirty hack to work around problem in X.Web.RSS with the date format.
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
// Items = (from build in builds
|
||||
// select new RssItem()
|
||||
// {
|
||||
// Title = build.FullBuildString,
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"),
|
||||
// Guid = new RssGuid()
|
||||
// {
|
||||
// IsPermaLink = true,
|
||||
// Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"
|
||||
// },
|
||||
// InternalPubDate = new RssDate(build.LeakDate.Value).DateStringISO8601 // bit of a dirty hack to work around problem in X.Web.RSS with the date format.
|
||||
// }).ToList()
|
||||
// }
|
||||
//};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
//Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
//await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
//return new EmptyResult();
|
||||
}
|
||||
|
||||
[Route("rss/version")]
|
||||
public async Task<ActionResult> version()
|
||||
{
|
||||
var builds = await bModel.SelectInVersionOrder(RSS_SIZE, 0);
|
||||
throw new NotImplementedException();
|
||||
//var builds = await bModel.SelectInVersionOrder(RSS_SIZE, 0);
|
||||
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = "BuildFeed RSS - Highest Version",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
//RssDocument rdoc = new RssDocument()
|
||||
//{
|
||||
// Channel = new RssChannel()
|
||||
// {
|
||||
// Title = "BuildFeed RSS - Highest Version",
|
||||
// Description = "",
|
||||
// Generator = "BuildFeed.net RSS Controller",
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
// SkipHours = new List<Hour>(),
|
||||
// SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
|
||||
Guid = new RssGuid()
|
||||
{
|
||||
IsPermaLink = true,
|
||||
Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"
|
||||
},
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
// Items = (from build in builds
|
||||
// select new RssItem()
|
||||
// {
|
||||
// Title = build.FullBuildString,
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"),
|
||||
// Guid = new RssGuid()
|
||||
// {
|
||||
// IsPermaLink = true,
|
||||
// Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"
|
||||
// },
|
||||
// }).ToList()
|
||||
// }
|
||||
//};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
//Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
//await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
//return new EmptyResult();
|
||||
}
|
||||
|
||||
[Route("rss/flight/{id}")]
|
||||
public async Task<ActionResult> flight(LevelOfFlight id)
|
||||
{
|
||||
var builds = await bModel.SelectFlight(id, RSS_SIZE, 0);
|
||||
throw new NotImplementedException();
|
||||
//var builds = await bModel.SelectFlight(id, RSS_SIZE, 0);
|
||||
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = $"BuildFeed RSS - {id} Flight Level",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
//RssDocument rdoc = new RssDocument()
|
||||
//{
|
||||
// Channel = new RssChannel()
|
||||
// {
|
||||
// Title = $"BuildFeed RSS - {id} Flight Level",
|
||||
// Description = "",
|
||||
// Generator = "BuildFeed.net RSS Controller",
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
// SkipHours = new List<Hour>(),
|
||||
// SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
|
||||
Guid = new RssGuid()
|
||||
{
|
||||
IsPermaLink = true,
|
||||
Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"
|
||||
},
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
// Items = (from build in builds
|
||||
// select new RssItem()
|
||||
// {
|
||||
// Title = build.FullBuildString,
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"),
|
||||
// Guid = new RssGuid()
|
||||
// {
|
||||
// IsPermaLink = true,
|
||||
// Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"
|
||||
// },
|
||||
// }).ToList()
|
||||
// }
|
||||
//};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
//Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
//await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
//return new EmptyResult();
|
||||
}
|
||||
|
||||
[Route("rss/lab/{lab}")]
|
||||
public async Task<ActionResult> lab(string lab)
|
||||
{
|
||||
var builds = await bModel.SelectLab(lab, 0, RSS_SIZE);
|
||||
throw new NotImplementedException();
|
||||
//var builds = await bModel.SelectLab(lab, 0, RSS_SIZE);
|
||||
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = $"BuildFeed RSS - {lab} Lab",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
//RssDocument rdoc = new RssDocument()
|
||||
//{
|
||||
// Channel = new RssChannel()
|
||||
// {
|
||||
// Title = $"BuildFeed RSS - {lab} Lab",
|
||||
// Description = "",
|
||||
// Generator = "BuildFeed.net RSS Controller",
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
|
||||
// SkipHours = new List<Hour>(),
|
||||
// SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
|
||||
Guid = new RssGuid()
|
||||
{
|
||||
IsPermaLink = true,
|
||||
Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"
|
||||
},
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
// Items = (from build in builds
|
||||
// select new RssItem()
|
||||
// {
|
||||
// Title = build.FullBuildString,
|
||||
// Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"),
|
||||
// Guid = new RssGuid()
|
||||
// {
|
||||
// IsPermaLink = true,
|
||||
// Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "Front", id = build.Id })}"
|
||||
// },
|
||||
// }).ToList()
|
||||
// }
|
||||
//};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
//Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
//await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
//return new EmptyResult();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -129,7 +129,7 @@ public ActionResult register(RegistrationUser ru)
|
|||
[Route("rss")]
|
||||
public async Task<ActionResult> rss()
|
||||
{
|
||||
ViewBag.Labs = await bModel.SelectLabs();
|
||||
ViewBag.Labs = await bModel.SelectAllLabs();
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -139,135 +139,136 @@ public async Task<ActionResult> rss()
|
|||
#endif
|
||||
public async Task<ActionResult> sitemap()
|
||||
{
|
||||
var builds = await bModel.SelectInVersionOrder();
|
||||
Dictionary<string, SitemapPagedAction[]> actions = new Dictionary<string, SitemapPagedAction[]>();
|
||||
actions.Add("Pages", new[]
|
||||
{
|
||||
new SitemapPagedAction()
|
||||
{
|
||||
UrlParams = new RouteValueDictionary(new
|
||||
{
|
||||
controller = "front",
|
||||
action = "index",
|
||||
page = 1
|
||||
}),
|
||||
Pages = (builds.Count() + (frontController.PAGE_SIZE - 1)) / frontController.PAGE_SIZE
|
||||
}
|
||||
});
|
||||
throw new NotImplementedException();
|
||||
//var builds = await bModel.SelectInVersionOrder();
|
||||
//Dictionary<string, SitemapPagedAction[]> actions = new Dictionary<string, SitemapPagedAction[]>();
|
||||
//actions.Add("Pages", new[]
|
||||
// {
|
||||
// new SitemapPagedAction()
|
||||
// {
|
||||
// UrlParams = new RouteValueDictionary(new
|
||||
// {
|
||||
// controller = "front",
|
||||
// action = "index",
|
||||
// page = 1
|
||||
// }),
|
||||
// Pages = (builds.Count() + (FrontController.PageSize - 1)) / FrontController.PageSize
|
||||
// }
|
||||
// });
|
||||
|
||||
actions.Add("Versions", (from b in builds
|
||||
group b by new BuildVersion()
|
||||
{
|
||||
Major = b.MajorVersion,
|
||||
Minor = b.MinorVersion
|
||||
}
|
||||
into bv
|
||||
orderby bv.Key.Major descending,
|
||||
bv.Key.Minor descending
|
||||
select new SitemapPagedAction()
|
||||
{
|
||||
Name = $"{Common.ProductName} {bv.Key.Major}.{bv.Key.Minor}",
|
||||
UrlParams = new RouteValueDictionary(new
|
||||
{
|
||||
controller = "front",
|
||||
action = "viewVersion",
|
||||
major = bv.Key.Major,
|
||||
minor = bv.Key.Minor,
|
||||
page = 1
|
||||
}),
|
||||
Pages = (bv.Count() + (frontController.PAGE_SIZE - 1)) / frontController.PAGE_SIZE
|
||||
}).ToArray());
|
||||
//actions.Add("Versions", (from b in builds
|
||||
// group b by new BuildVersion()
|
||||
// {
|
||||
// Major = b.MajorVersion,
|
||||
// Minor = b.MinorVersion
|
||||
// }
|
||||
// into bv
|
||||
// orderby bv.Key.Major descending,
|
||||
// bv.Key.Minor descending
|
||||
// select new SitemapPagedAction()
|
||||
// {
|
||||
// Name = $"{Common.ProductName} {bv.Key.Major}.{bv.Key.Minor}",
|
||||
// UrlParams = new RouteValueDictionary(new
|
||||
// {
|
||||
// controller = "front",
|
||||
// action = "viewVersion",
|
||||
// major = bv.Key.Major,
|
||||
// minor = bv.Key.Minor,
|
||||
// page = 1
|
||||
// }),
|
||||
// Pages = (bv.Count() + (FrontController.PageSize - 1)) / FrontController.PageSize
|
||||
// }).ToArray());
|
||||
|
||||
actions.Add("Labs", (from b in builds
|
||||
where !string.IsNullOrEmpty(b.Lab)
|
||||
group b by b.Lab
|
||||
into bv
|
||||
orderby bv.Key
|
||||
select new SitemapPagedAction()
|
||||
{
|
||||
Name = bv.Key,
|
||||
UrlParams = new RouteValueDictionary(new
|
||||
{
|
||||
controller = "front",
|
||||
action = "viewLab",
|
||||
lab = bv.Key,
|
||||
page = 1
|
||||
}),
|
||||
Pages = (bv.Count() + (frontController.PAGE_SIZE - 1)) / frontController.PAGE_SIZE
|
||||
}).ToArray());
|
||||
//actions.Add("Labs", (from b in builds
|
||||
// where !string.IsNullOrEmpty(b.Lab)
|
||||
// group b by b.Lab
|
||||
// into bv
|
||||
// orderby bv.Key
|
||||
// select new SitemapPagedAction()
|
||||
// {
|
||||
// Name = bv.Key,
|
||||
// UrlParams = new RouteValueDictionary(new
|
||||
// {
|
||||
// controller = "front",
|
||||
// action = "viewLab",
|
||||
// lab = bv.Key,
|
||||
// page = 1
|
||||
// }),
|
||||
// Pages = (bv.Count() + (FrontController.PageSize - 1)) / FrontController.PageSize
|
||||
// }).ToArray());
|
||||
|
||||
actions.Add("Years", (from b in builds
|
||||
where b.BuildTime.HasValue
|
||||
group b by b.BuildTime.Value.Year
|
||||
into bv
|
||||
orderby bv.Key descending
|
||||
select new SitemapPagedAction()
|
||||
{
|
||||
Name = bv.Key.ToString(),
|
||||
UrlParams = new RouteValueDictionary(new
|
||||
{
|
||||
controller = "front",
|
||||
action = "viewYear",
|
||||
year = bv.Key,
|
||||
page = 1
|
||||
}),
|
||||
Pages = (bv.Count() + (frontController.PAGE_SIZE - 1)) / frontController.PAGE_SIZE
|
||||
}).ToArray());
|
||||
//actions.Add("Years", (from b in builds
|
||||
// where b.BuildTime.HasValue
|
||||
// group b by b.BuildTime.Value.Year
|
||||
// into bv
|
||||
// orderby bv.Key descending
|
||||
// select new SitemapPagedAction()
|
||||
// {
|
||||
// Name = bv.Key.ToString(),
|
||||
// UrlParams = new RouteValueDictionary(new
|
||||
// {
|
||||
// controller = "front",
|
||||
// action = "viewYear",
|
||||
// year = bv.Key,
|
||||
// page = 1
|
||||
// }),
|
||||
// Pages = (bv.Count() + (FrontController.PageSize - 1)) / FrontController.PageSize
|
||||
// }).ToArray());
|
||||
|
||||
actions.Add("Sources", (from b in builds
|
||||
group b by b.SourceType
|
||||
into bv
|
||||
orderby bv.Key
|
||||
select new SitemapPagedAction()
|
||||
{
|
||||
Name = DisplayHelpers.GetDisplayTextForEnum(bv.Key),
|
||||
UrlParams = new RouteValueDictionary(new
|
||||
{
|
||||
controller = "front",
|
||||
action = "viewSource",
|
||||
source = bv.Key,
|
||||
page = 1
|
||||
}),
|
||||
Pages = (bv.Count() + (frontController.PAGE_SIZE - 1)) / frontController.PAGE_SIZE
|
||||
}).ToArray());
|
||||
//actions.Add("Sources", (from b in builds
|
||||
// group b by b.SourceType
|
||||
// into bv
|
||||
// orderby bv.Key
|
||||
// select new SitemapPagedAction()
|
||||
// {
|
||||
// Name = DisplayHelpers.GetDisplayTextForEnum(bv.Key),
|
||||
// UrlParams = new RouteValueDictionary(new
|
||||
// {
|
||||
// controller = "front",
|
||||
// action = "viewSource",
|
||||
// source = bv.Key,
|
||||
// page = 1
|
||||
// }),
|
||||
// Pages = (bv.Count() + (FrontController.PageSize - 1)) / FrontController.PageSize
|
||||
// }).ToArray());
|
||||
|
||||
SitemapData model = new SitemapData()
|
||||
{
|
||||
Builds = (from b in builds
|
||||
group b by new
|
||||
{
|
||||
Major = b.MajorVersion,
|
||||
Minor = b.MinorVersion,
|
||||
Build = b.Number,
|
||||
Revision = b.Revision
|
||||
} into bg
|
||||
orderby bg.Key.Major descending,
|
||||
bg.Key.Minor descending,
|
||||
bg.Key.Build descending,
|
||||
bg.Key.Revision descending
|
||||
select new SitemapDataBuildGroup()
|
||||
{
|
||||
Id = new BuildGroup() {
|
||||
Major = bg.Key.Major,
|
||||
Minor = bg.Key.Minor,
|
||||
Build = bg.Key.Build,
|
||||
Revision = bg.Key.Revision
|
||||
},
|
||||
Builds = (from bgb in bg
|
||||
select new SitemapDataBuild()
|
||||
{
|
||||
Id = bgb.Id,
|
||||
Name = bgb.FullBuildString
|
||||
}).ToArray()
|
||||
}).ToArray(),
|
||||
//SitemapData model = new SitemapData()
|
||||
//{
|
||||
// Builds = (from b in builds
|
||||
// group b by new
|
||||
// {
|
||||
// Major = b.MajorVersion,
|
||||
// Minor = b.MinorVersion,
|
||||
// Build = b.Number,
|
||||
// Revision = b.Revision
|
||||
// } into bg
|
||||
// orderby bg.Key.Major descending,
|
||||
// bg.Key.Minor descending,
|
||||
// bg.Key.Build descending,
|
||||
// bg.Key.Revision descending
|
||||
// select new SitemapDataBuildGroup()
|
||||
// {
|
||||
// Id = new BuildGroup() {
|
||||
// Major = bg.Key.Major,
|
||||
// Minor = bg.Key.Minor,
|
||||
// Build = bg.Key.Build,
|
||||
// Revision = bg.Key.Revision
|
||||
// },
|
||||
// Builds = (from bgb in bg
|
||||
// select new SitemapDataBuild()
|
||||
// {
|
||||
// Id = bgb.Id,
|
||||
// Name = bgb.FullBuildString
|
||||
// }).ToArray()
|
||||
// }).ToArray(),
|
||||
|
||||
Actions = actions,
|
||||
Labs = (from b in builds
|
||||
group b by b.Lab into lab
|
||||
select lab.Key).ToArray()
|
||||
};
|
||||
// Actions = actions,
|
||||
// Labs = (from b in builds
|
||||
// group b by b.Lab into lab
|
||||
// select lab.Key).ToArray()
|
||||
//};
|
||||
|
||||
return View(model);
|
||||
//return View(model);
|
||||
}
|
||||
|
||||
[Route("xml-sitemap/")]
|
||||
|
@ -281,14 +282,14 @@ public async Task<ActionResult> xmlsitemap()
|
|||
|
||||
// home page
|
||||
XElement home = new XElement(xn + "url");
|
||||
home.Add(new XElement(xn + "loc", Request.Url.GetLeftPart(UriPartial.Authority) + "/"));
|
||||
home.Add(new XElement(xn + "loc", Request.Url?.GetLeftPart(UriPartial.Authority) + "/"));
|
||||
home.Add(new XElement(xn + "changefreq", "daily"));
|
||||
xlist.Add(home);
|
||||
|
||||
foreach (var b in await bModel.Select())
|
||||
{
|
||||
XElement url = new XElement(xn + "url");
|
||||
url.Add(new XElement(xn + "loc", Request.Url.GetLeftPart(UriPartial.Authority) + Url.Action("viewBuild", "front", new { id = b.Id })));
|
||||
url.Add(new XElement(xn + "loc", Request.Url?.GetLeftPart(UriPartial.Authority) + Url.Action("viewBuild", "Front", new { id = b.Id })));
|
||||
if (b.Modified != DateTime.MinValue)
|
||||
{
|
||||
url.Add(new XElement(xn + "lastmod", b.Modified.ToString("yyyy-MM-dd")));
|
||||
|
|
|
@ -1,72 +1,87 @@
|
|||
using BuildFeed.Models.ViewModel.Front;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BuildFeed.Models.ViewModel.Front;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
public partial class Build
|
||||
{
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<Tuple<BuildGroup, List<BuildModel>>> SelectBuildGroup(BuildGroup bGroup)
|
||||
public async Task<FrontBuildGroup[]> SelectAllGroups(int limit = -1, int skip = 0)
|
||||
{
|
||||
var pipeline = _buildCollection
|
||||
.Find(new BsonDocument
|
||||
{
|
||||
{ "MajorVersion", BsonValue.Create(bGroup.Major) },
|
||||
{ "MinorVersion", BsonValue.Create(bGroup.Minor) },
|
||||
{ "Number", BsonValue.Create(bGroup.Build) },
|
||||
{ "Revision", BsonValue.Create(bGroup.Revision) },
|
||||
})
|
||||
.SortByDescending(b => b.BuildTime);
|
||||
var query = _buildCollection.Aggregate()
|
||||
.Group(
|
||||
new BsonDocument
|
||||
{
|
||||
new BsonElement(
|
||||
"_id", new BsonDocument
|
||||
{
|
||||
new BsonElement(nameof(BuildGroup.Major), $"${nameof(BuildModel.MajorVersion)}"),
|
||||
new BsonElement(nameof(BuildGroup.Minor), $"${nameof(BuildModel.MinorVersion)}"),
|
||||
new BsonElement(nameof(BuildGroup.Build), $"${nameof(BuildModel.Number)}"),
|
||||
new BsonElement(nameof(BuildGroup.Revision), $"${nameof(BuildModel.Revision)}")
|
||||
}),
|
||||
new BsonElement("date", new BsonDocument("$max", $"${nameof(BuildModel.BuildTime)}")),
|
||||
new BsonElement("count", new BsonDocument("$sum", 1))
|
||||
})
|
||||
.Sort(
|
||||
new BsonDocument
|
||||
{
|
||||
new BsonElement($"_id.{nameof(BuildGroup.Major)}", -1),
|
||||
new BsonElement($"_id.{nameof(BuildGroup.Minor)}", -1),
|
||||
new BsonElement($"_id.{nameof(BuildGroup.Build)}", -1),
|
||||
new BsonElement($"_id.{nameof(BuildGroup.Revision)}", -1)
|
||||
});
|
||||
|
||||
return new Tuple<BuildGroup, List<BuildModel>>(bGroup, await pipeline.ToListAsync());
|
||||
if (limit > 0)
|
||||
{
|
||||
query = query
|
||||
.Limit(limit);
|
||||
}
|
||||
|
||||
var grouping = await query
|
||||
.Skip(skip)
|
||||
.ToListAsync();
|
||||
|
||||
return (from g in grouping
|
||||
select new FrontBuildGroup
|
||||
{
|
||||
Key = new BuildGroup
|
||||
{
|
||||
Major = (uint) g["_id"].AsBsonDocument[nameof(BuildGroup.Major)].AsInt32,
|
||||
Minor = (uint) g["_id"].AsBsonDocument[nameof(BuildGroup.Minor)].AsInt32,
|
||||
Build = (uint) g["_id"].AsBsonDocument[nameof(BuildGroup.Build)].AsInt32,
|
||||
Revision = (uint) g["_id"].AsBsonDocument[nameof(BuildGroup.Revision)].AsInt32
|
||||
},
|
||||
LastBuild = g["date"].ToNullableUniversalTime(),
|
||||
BuildCount = g["count"].AsInt32
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<FrontBuildGroup>> SelectBuildGroups(int limit, int skip)
|
||||
public async Task<int> SelectAllGroupsCount()
|
||||
{
|
||||
return await _buildCollection.Aggregate()
|
||||
.Group(b => new BuildGroup()
|
||||
{
|
||||
Major = b.MajorVersion,
|
||||
Minor = b.MinorVersion,
|
||||
Build = b.Number,
|
||||
Revision = b.Revision
|
||||
},
|
||||
bg => new FrontBuildGroup()
|
||||
{
|
||||
Key = bg.Key,
|
||||
BuildCount = bg.Count(),
|
||||
LastBuild = bg.Max(b => b.BuildTime)
|
||||
})
|
||||
.SortByDescending(b => b.Key.Major)
|
||||
.ThenByDescending(b => b.Key.Minor)
|
||||
.ThenByDescending(b => b.Key.Build)
|
||||
.ThenByDescending(b => b.Key.Revision)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
var grouping = await _buildCollection.Aggregate()
|
||||
.Group(
|
||||
new BsonDocument
|
||||
{
|
||||
new BsonElement(
|
||||
"_id", new BsonDocument
|
||||
{
|
||||
new BsonElement(nameof(BuildGroup.Major), $"${nameof(BuildModel.MajorVersion)}"),
|
||||
new BsonElement(nameof(BuildGroup.Minor), $"${nameof(BuildModel.MinorVersion)}"),
|
||||
new BsonElement(nameof(BuildGroup.Build), $"${nameof(BuildModel.Number)}"),
|
||||
new BsonElement(nameof(BuildGroup.Revision), $"${nameof(BuildModel.Revision)}")
|
||||
})
|
||||
})
|
||||
.ToListAsync();
|
||||
return grouping.Count;
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, true)]
|
||||
public async Task<int> SelectBuildGroupsCount()
|
||||
{
|
||||
var pipeline = _buildCollection.Aggregate()
|
||||
.Group(b => new BuildGroup()
|
||||
{
|
||||
Major = b.MajorVersion,
|
||||
Minor = b.MinorVersion,
|
||||
Build = b.Number,
|
||||
Revision = b.Revision
|
||||
},
|
||||
bg => new BsonDocument());
|
||||
public async Task<List<BuildModel>> SelectGroup(BuildGroup group, int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
return (await pipeline.ToListAsync()).Count;
|
||||
}
|
||||
public async Task<List<BuildModel>> SelectGroupCount(BuildGroup group) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
|
@ -1,86 +1,19 @@
|
|||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
public partial class Build
|
||||
{
|
||||
public Task<string[]> SelectAllLabs(int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectLab(string lab, int skip, int limit)
|
||||
{
|
||||
string labUrl = lab.Replace('/', '-').ToLower();
|
||||
return await _buildCollection.Find(b => b.Lab != null && b.LabUrl == labUrl)
|
||||
.SortByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
}
|
||||
public async Task<int> SelectAllLabsCount() { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<string>> SelectLabs()
|
||||
{
|
||||
var result = await _buildCollection.Aggregate()
|
||||
.Match(b => b.Lab != null)
|
||||
.Match(b => b.Lab != "")
|
||||
.Group(b => b.Lab.ToLower(),
|
||||
// incoming bullshit hack
|
||||
bg => new Tuple<string>(bg.Key))
|
||||
.SortBy(b => b.Item1)
|
||||
.ToListAsync();
|
||||
public async Task<List<BuildModel>> SelectLab(string lab, int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
// work ourselves out of aforementioned bullshit hack
|
||||
return result.Select(b => b.Item1).ToList();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<string>> SelectLabs(uint major, uint minor)
|
||||
{
|
||||
var result = await _buildCollection.Aggregate()
|
||||
.Match(b => b.MajorVersion == major)
|
||||
.Match(b => b.MinorVersion == minor)
|
||||
.Match(b => b.Lab != null)
|
||||
.Match(b => b.Lab != "")
|
||||
.Group(b => b.Lab.ToLower(),
|
||||
// incoming bullshit hack
|
||||
bg => new Tuple<string>(bg.Key))
|
||||
.SortBy(b => b.Item1)
|
||||
.ToListAsync();
|
||||
|
||||
// work ourselves out of aforementioned bullshit hack
|
||||
return result.Select(b => b.Item1).ToList();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<long> SelectLabCount(string lab)
|
||||
{
|
||||
string labUrl = lab.Replace('/', '-').ToLower();
|
||||
return await _buildCollection.Find(b => b.Lab != null && b.LabUrl == labUrl)
|
||||
.CountAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<string>> SearchBuildLabs(string query)
|
||||
{
|
||||
var result = await _buildCollection.Aggregate()
|
||||
.Match(b => b.Lab != null)
|
||||
.Match(b => b.Lab != "")
|
||||
.Match(b => b.Lab.ToLower().Contains(query.ToLower()))
|
||||
.Group(b => b.Lab.ToLower(),
|
||||
// incoming bullshit hack
|
||||
bg => new Tuple<string>(bg.Key))
|
||||
.ToListAsync();
|
||||
|
||||
// work ourselves out of aforementioned bullshit hack
|
||||
return result.Select(b => b.Item1).ToList();
|
||||
}
|
||||
public async Task<int> SelectLabCount(string lab) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
|
@ -1,32 +1,19 @@
|
|||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
public partial class Build
|
||||
{
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectSource(TypeOfSource source, int skip, int limit)
|
||||
{
|
||||
return await _buildCollection.Find(b => b.SourceType == source)
|
||||
.SortByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
}
|
||||
public Task<TypeOfSource[]> SelectAllSources(int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<long> SelectSourceCount(TypeOfSource source)
|
||||
{
|
||||
return await _buildCollection.Find(b => b.SourceType == source)
|
||||
.CountAsync();
|
||||
}
|
||||
public async Task<int> SelectAllSourcesCount() { throw new NotImplementedException(); }
|
||||
|
||||
public async Task<List<BuildModel>> SelectSource(TypeOfSource source, int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
public async Task<int> SelectSourceCount(TypeOfSource source) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
|
@ -1,84 +1,19 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
public partial class Build
|
||||
{
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectInVersionOrder()
|
||||
{
|
||||
return await _buildCollection.Find(new BsonDocument())
|
||||
.SortByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.ThenByDescending(b => b.BuildTime)
|
||||
.ToListAsync();
|
||||
}
|
||||
public async Task<BuildVersion[]> SelectAllVersions(int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectInVersionOrder(int limit, int skip)
|
||||
{
|
||||
return await _buildCollection.Find(new BsonDocument())
|
||||
.SortByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.ThenByDescending(b => b.BuildTime)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
}
|
||||
public async Task<int> SelectAllVersionsCount() { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectVersion(uint major, uint minor, int skip, int limit)
|
||||
{
|
||||
byte bMajor = Convert.ToByte(major), bMinor = Convert.ToByte(minor);
|
||||
var test = await _buildCollection.Find(Builders<BuildModel>.Filter.And(Builders<BuildModel>.Filter.Eq(b => b.MajorVersion, bMajor), Builders<BuildModel>.Filter.Eq(b => b.MinorVersion, bMinor)))
|
||||
.SortByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
return test;
|
||||
}
|
||||
public async Task<List<BuildModel>> SelectVersion(uint major, uint minor, int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildVersion>> SelectVersions()
|
||||
{
|
||||
var result = await _buildCollection.Aggregate()
|
||||
// the group method in mongodb's c# driver sucks balls and throws a hissy fit over far too much.
|
||||
.Group(b => new BuildVersion(b.MajorVersion, b.MinorVersion), bg => new BsonDocument())
|
||||
.ToListAsync();
|
||||
|
||||
// work ourselves out of aforementioned bullshit hack
|
||||
var typed = from r in result
|
||||
select new BuildVersion
|
||||
{
|
||||
Major = (uint)r["_id"]["Major"].ToInt32(),
|
||||
Minor = (uint)r["_id"]["Minor"].ToInt32()
|
||||
};
|
||||
|
||||
return (from t in typed
|
||||
orderby t.Major descending,
|
||||
t.Minor descending
|
||||
select t).ToList();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<long> SelectVersionCount(uint major, uint minor)
|
||||
{
|
||||
return await _buildCollection.Find(Builders<BuildModel>.Filter.And(Builders<BuildModel>.Filter.Eq(b => b.MajorVersion, major), Builders<BuildModel>.Filter.Eq(b => b.MinorVersion, minor)))
|
||||
.CountAsync();
|
||||
}
|
||||
public async Task<int> SelectVersionCount(uint major, uint minor) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
|
@ -1,52 +1,19 @@
|
|||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
public partial class Build
|
||||
{
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectYear(int year, int skip, int limit)
|
||||
{
|
||||
return await _buildCollection.Find(b => b.BuildTime != null &&
|
||||
(b.BuildTime > new DateTime(year, 1, 1, 0, 0, 0)) &&
|
||||
(b.BuildTime < new DateTime(year, 12, 31, 23, 59, 59)))
|
||||
.SortByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
}
|
||||
public async Task<int[]> SelectAllYears(int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<int>> SelectYears()
|
||||
{
|
||||
var result = await _buildCollection.Aggregate()
|
||||
.Match(b => b.BuildTime != null)
|
||||
.Group(b => ((DateTime)b.BuildTime).Year,
|
||||
// incoming bullshit hack
|
||||
bg => new Tuple<int>(bg.Key))
|
||||
.SortByDescending(b => b.Item1)
|
||||
.ToListAsync();
|
||||
public async Task<int> SelectAllYearsCount() { throw new NotImplementedException(); }
|
||||
|
||||
// work ourselves out of aforementioned bullshit hack
|
||||
return result.Select(b => b.Item1).ToList();
|
||||
}
|
||||
public async Task<List<BuildModel>> SelectYear(int year, int limit = -1, int skip = 0) { throw new NotImplementedException(); }
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<long> SelectYearCount(int year)
|
||||
{
|
||||
return await _buildCollection.Find(b => b.BuildTime != null &&
|
||||
(b.BuildTime > new DateTime(year, 1, 1, 0, 0, 0)) &&
|
||||
(b.BuildTime < new DateTime(year, 12, 31, 23, 59, 59)))
|
||||
.CountAsync();
|
||||
}
|
||||
public async Task<int> SelectYearCount(int year) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
|
@ -1,133 +1,81 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
|
||||
public partial class Build
|
||||
{
|
||||
private const string _buildCollectionName = "builds";
|
||||
|
||||
private MongoClient _dbClient;
|
||||
private IMongoCollection<BuildModel> _buildCollection;
|
||||
private const string BUILD_COLLECTION_NAME = "builds";
|
||||
private readonly IMongoCollection<BuildModel> _buildCollection;
|
||||
private readonly IMongoDatabase _buildDatabase;
|
||||
private readonly MongoClient _dbClient;
|
||||
|
||||
public Build()
|
||||
{
|
||||
_dbClient = new MongoClient(new MongoClientSettings()
|
||||
{
|
||||
Server = new MongoServerAddress(MongoConfig.Host, MongoConfig.Port)
|
||||
});
|
||||
_dbClient = new MongoClient
|
||||
(new MongoClientSettings
|
||||
{
|
||||
Server = new MongoServerAddress(MongoConfig.Host, MongoConfig.Port)
|
||||
});
|
||||
|
||||
_buildCollection = _dbClient.GetDatabase(MongoConfig.Database).GetCollection<BuildModel>(_buildCollectionName);
|
||||
_buildDatabase = _dbClient.GetDatabase(MongoConfig.Database);
|
||||
_buildCollection = _buildDatabase.GetCollection<BuildModel>(BUILD_COLLECTION_NAME);
|
||||
}
|
||||
|
||||
public async Task SetupIndexes()
|
||||
{
|
||||
var indexes = await (await _buildCollection.Indexes.ListAsync()).ToListAsync();
|
||||
if(!indexes.Any(i => i["name"] == "_idx_group"))
|
||||
if (indexes.All(i => i["name"] != "_idx_group"))
|
||||
{
|
||||
await _buildCollection.Indexes.CreateOneAsync(Builders<BuildModel>.IndexKeys.Combine(
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.MajorVersion),
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.MinorVersion),
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.Number),
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.Revision)
|
||||
), new CreateIndexOptions()
|
||||
{
|
||||
Name = "_idx_group"
|
||||
});
|
||||
await _buildCollection.Indexes.CreateOneAsync
|
||||
(Builders<BuildModel>.IndexKeys.Combine
|
||||
(
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.MajorVersion),
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.MinorVersion),
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.Number),
|
||||
Builders<BuildModel>.IndexKeys.Descending(b => b.Revision)
|
||||
), new CreateIndexOptions
|
||||
{
|
||||
Name = "_idx_group"
|
||||
});
|
||||
}
|
||||
|
||||
if (!indexes.Any(i => i["name"] == "_idx_legacy"))
|
||||
if (indexes.All(i => i["name"] != "_idx_legacy"))
|
||||
{
|
||||
await _buildCollection.Indexes.CreateOneAsync(Builders<BuildModel>.IndexKeys.Ascending(b => b.LegacyId), new CreateIndexOptions()
|
||||
{
|
||||
Name = "_idx_legacy"
|
||||
});
|
||||
await _buildCollection.Indexes.CreateOneAsync
|
||||
(Builders<BuildModel>.IndexKeys.Ascending(b => b.LegacyId), new CreateIndexOptions
|
||||
{
|
||||
Name = "_idx_legacy"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, true)]
|
||||
public async Task<List<BuildModel>> Select()
|
||||
{
|
||||
return await _buildCollection.Find(new BsonDocument()).ToListAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, true)]
|
||||
public async Task<List<BuildModel>> SelectLatest(int limit, int skip)
|
||||
{
|
||||
return await _buildCollection.Find(new BsonDocument())
|
||||
.SortByDescending(b => b.Added)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, true)]
|
||||
public async Task<List<BuildModel>> SelectLatestLeaked(int limit, int skip)
|
||||
{
|
||||
return await _buildCollection.Find(b => b.LeakDate != null)
|
||||
.SortByDescending(b => b.LeakDate)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<BuildModel> SelectById(Guid id)
|
||||
{
|
||||
return await _buildCollection.Find(f => f.Id == id).SingleOrDefaultAsync();
|
||||
return await _buildCollection
|
||||
.Find(Builders<BuildModel>.Filter.Eq(b => b.Id, id))
|
||||
.SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<BuildModel> SelectByLegacyId(long id)
|
||||
{
|
||||
return await _buildCollection.Find(f => f.LegacyId == id).SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectInBuildOrder()
|
||||
{
|
||||
return await _buildCollection.Find(new BsonDocument())
|
||||
.SortByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectInBuildOrder(int limit, int skip)
|
||||
{
|
||||
return await _buildCollection.Find(new BsonDocument())
|
||||
.SortByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<BuildModel>> SelectFlight(LevelOfFlight flight, int limit, int skip)
|
||||
{
|
||||
return await _buildCollection.Find(b => b.FlightLevel == flight)
|
||||
.SortByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.Skip(skip)
|
||||
.Limit(limit)
|
||||
.ToListAsync();
|
||||
return await _buildCollection
|
||||
.Find(Builders<BuildModel>.Filter.Eq(b => b.LegacyId, id))
|
||||
.SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert, true)]
|
||||
|
@ -135,19 +83,21 @@ public async Task Insert(BuildModel item)
|
|||
{
|
||||
item.Id = Guid.NewGuid();
|
||||
item.LabUrl = item.GenerateLabUrl();
|
||||
await _buildCollection.InsertOneAsync(item);
|
||||
await _buildCollection
|
||||
.InsertOneAsync(item);
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert, false)]
|
||||
public async Task InsertAll(IEnumerable<BuildModel> items)
|
||||
{
|
||||
foreach(var item in items)
|
||||
foreach (BuildModel item in items)
|
||||
{
|
||||
item.Id = Guid.NewGuid();
|
||||
item.LabUrl = item.GenerateLabUrl();
|
||||
}
|
||||
|
||||
await _buildCollection.InsertManyAsync(items);
|
||||
await _buildCollection
|
||||
.InsertManyAsync(items);
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Update, true)]
|
||||
|
@ -158,13 +108,15 @@ public async Task Update(BuildModel item)
|
|||
item.Modified = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
item.LabUrl = item.GenerateLabUrl();
|
||||
|
||||
await _buildCollection.ReplaceOneAsync(f => f.Id == item.Id, item);
|
||||
await _buildCollection
|
||||
.ReplaceOneAsync(Builders<BuildModel>.Filter.Eq(b => b.Id, item.Id), item);
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Delete, true)]
|
||||
public async Task DeleteById(Guid id)
|
||||
{
|
||||
await _buildCollection.DeleteOneAsync(f => f.Id == id);
|
||||
await _buildCollection
|
||||
.DeleteOneAsync(Builders<BuildModel>.Filter.Eq(b => b.Id, id));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,8 +7,8 @@ public class BuildGroup
|
|||
public uint Build { get; set; }
|
||||
public uint? Revision { get; set; }
|
||||
|
||||
public override string ToString() => Revision.HasValue ?
|
||||
$"{Major}.{Minor}.{Build}.{Revision.Value}" :
|
||||
$"{Major}.{Minor}.{Build}";
|
||||
public override string ToString() => Revision.HasValue
|
||||
? $"{Major}.{Minor}.{Build}.{Revision.Value}"
|
||||
: $"{Major}.{Minor}.{Build}";
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
using BuildFeed.Local;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using BuildFeed.Local;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Required = System.ComponentModel.DataAnnotations.RequiredAttribute;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
|
@ -93,13 +93,19 @@ public string FullBuildString
|
|||
sb.AppendFormat("{0}.{1}.{2}", MajorVersion, MinorVersion, Number);
|
||||
|
||||
if (Revision.HasValue)
|
||||
{
|
||||
sb.AppendFormat(".{0}", Revision);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Lab))
|
||||
{
|
||||
sb.AppendFormat(".{0}", Lab);
|
||||
}
|
||||
|
||||
if (BuildTime.HasValue)
|
||||
{
|
||||
sb.AppendFormat(".{0:yyMMdd-HHmm}", BuildTime);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
@ -113,47 +119,47 @@ public ProjectFamily Family
|
|||
{
|
||||
return ProjectFamily.Redstone;
|
||||
}
|
||||
else if (Number >= 10500)
|
||||
if (Number >= 10500)
|
||||
{
|
||||
return ProjectFamily.Threshold2;
|
||||
}
|
||||
else if (Number >= 9700)
|
||||
if (Number >= 9700)
|
||||
{
|
||||
return ProjectFamily.Threshold;
|
||||
}
|
||||
else if (Number >= 9250)
|
||||
if (Number >= 9250)
|
||||
{
|
||||
return ProjectFamily.Windows81;
|
||||
}
|
||||
else if (Number >= 7650)
|
||||
if (Number >= 7650)
|
||||
{
|
||||
return ProjectFamily.Windows8;
|
||||
}
|
||||
else if (Number >= 6020)
|
||||
if (Number >= 6020)
|
||||
{
|
||||
return ProjectFamily.Windows7;
|
||||
}
|
||||
else if (MajorVersion == 6 && Number >= 5000)
|
||||
if (MajorVersion == 6 && Number >= 5000)
|
||||
{
|
||||
return ProjectFamily.WindowsVista;
|
||||
}
|
||||
else if (MajorVersion == 6)
|
||||
if (MajorVersion == 6)
|
||||
{
|
||||
return ProjectFamily.Longhorn;
|
||||
}
|
||||
else if (MajorVersion == 5 && Number >= 3000)
|
||||
if (MajorVersion == 5 && Number >= 3000)
|
||||
{
|
||||
return ProjectFamily.Server2003;
|
||||
}
|
||||
else if (MajorVersion == 5 && Number >= 2205)
|
||||
if (MajorVersion == 5 && Number >= 2205)
|
||||
{
|
||||
return ProjectFamily.WindowsXP;
|
||||
}
|
||||
else if (MajorVersion == 5 && MinorVersion == 50)
|
||||
if (MajorVersion == 5 && MinorVersion == 50)
|
||||
{
|
||||
return ProjectFamily.Neptune;
|
||||
}
|
||||
else if (MajorVersion == 5)
|
||||
if (MajorVersion == 5)
|
||||
{
|
||||
return ProjectFamily.Windows2000;
|
||||
}
|
||||
|
@ -161,6 +167,7 @@ public ProjectFamily Family
|
|||
}
|
||||
}
|
||||
|
||||
public string GenerateLabUrl() => (Lab ?? "").Replace('/', '-').ToLower();
|
||||
public string GenerateLabUrl() => (Lab ?? "").Replace('/', '-')
|
||||
.ToLower();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
namespace BuildFeed.Models
|
||||
{
|
||||
|
||||
public struct BuildVersion
|
||||
{
|
||||
public uint Major { get; set; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using BuildFeed.Local;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using BuildFeed.Local;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using BuildFeed.Local;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using BuildFeed.Local;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ public async Task<MetaItemModel> SelectById(MetaItemKey id)
|
|||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<IEnumerable<string>> SelectUnusedLabs()
|
||||
{
|
||||
var labs = await bModel.SelectLabs();
|
||||
var labs = await bModel.SelectAllLabs();
|
||||
|
||||
var usedLabs = await _metaCollection.Find(f => f.Id.Type == MetaType.Lab).ToListAsync();
|
||||
|
||||
|
@ -86,7 +86,7 @@ where usedLabs.All(ul => ul.Id.Value != l)
|
|||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<IEnumerable<string>> SelectUnusedVersions()
|
||||
{
|
||||
var versions = await bModel.SelectVersions();
|
||||
var versions = await bModel.SelectAllVersions();
|
||||
|
||||
var usedVersions = await _metaCollection.Find(f => f.Id.Type == MetaType.Version).ToListAsync();
|
||||
|
||||
|
@ -98,7 +98,7 @@ where usedVersions.All(ul => ul.Id.Value != v.ToString())
|
|||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<IEnumerable<string>> SelectUnusedYears()
|
||||
{
|
||||
var years = await bModel.SelectYears();
|
||||
var years = await bModel.SelectAllYears();
|
||||
|
||||
var usedYears = await _metaCollection.Find(f => f.Id.Type == MetaType.Year).ToListAsync();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
@foreach (BuildFeed.Models.ViewModel.Front.FrontBuildGroup group in Model)
|
||||
{
|
||||
<div class="col-md-2 col-sm-3 col-xs-6 build-group">
|
||||
<h3 class="build-group-title"><a href="@Url.Action("viewGroup", new { major = group.Key.Major, minor = group.Key.Minor, number = group.Key.Build, revision = group.Key.Revision })">@group.Key.ToString()</a></h3>
|
||||
<h3 class="build-group-title"><a href="@Url.Action("ViewGroup", new { major = group.Key.Major, minor = group.Key.Minor, number = group.Key.Build, revision = group.Key.Revision })">@group.Key.ToString()</a></h3>
|
||||
<p>
|
||||
@if (group.LastBuild.HasValue)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
@if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
@Html.ActionLink(BuildFeed.Local.Front.Delete, "deleteBuild", new { id = Model.Id }, new { @class = "btn btn-danger btn-xs" })
|
||||
@Html.ActionLink(BuildFeed.Local.Front.Delete, "DeleteBuild", new { id = Model.Id }, new { @class = "btn btn-danger btn-xs" })
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
@ -82,7 +82,7 @@
|
|||
else
|
||||
{
|
||||
@Model.Lab<br />
|
||||
<a href="@Url.Action("viewLab", new { lab = Model.LabUrl })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> @string.Format(BuildFeed.Local.Front.MoreFromLab, Model.Lab)</a>
|
||||
<a href="@Url.Action("ViewLab", new { lab = Model.LabUrl })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> @string.Format(BuildFeed.Local.Front.MoreFromLab, Model.Lab)</a>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
@ -96,7 +96,7 @@
|
|||
{
|
||||
<time datetime="@Model.BuildTime.Value.ToString("yyyy-MM-dd HH:mm")" title="@Model.BuildTime.Value.ToString("h:mm tt on dddd, d MMMM yyyy")">@Html.DisplayFor(model => model.BuildTime, "{0:yyMMdd-HHmm}")</time>
|
||||
<br />
|
||||
<a href="@Url.Action("viewYear", new { year = Model.BuildTime.Value.Year })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> @string.Format(BuildFeed.Local.Front.MoreFromYear, Model.BuildTime.Value.Year)</a>
|
||||
<a href="@Url.Action("ViewYear", new { year = Model.BuildTime.Value.Year })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> @string.Format(BuildFeed.Local.Front.MoreFromYear, Model.BuildTime.Value.Year)</a>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
@ -110,7 +110,7 @@
|
|||
<div class="col-sm-8">
|
||||
<div class="form-control-static">
|
||||
@Html.DisplayFor(model => model.SourceType, "Enumeration")<br />
|
||||
<a href="@Url.Action("viewSource", new { source = Model.SourceType })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> @string.Format(BuildFeed.Local.Front.MoreFromSource, DisplayHelpers.GetDisplayTextForEnum(Model.SourceType))</a>
|
||||
<a href="@Url.Action("ViewSource", new { source = Model.SourceType })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> @string.Format(BuildFeed.Local.Front.MoreFromSource, DisplayHelpers.GetDisplayTextForEnum(Model.SourceType))</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -172,9 +172,9 @@
|
|||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-8">
|
||||
<a href="@Url.Action("viewGroup", new { major = Model.MajorVersion, minor = Model.MinorVersion, number = Model.Number, revision = Model.Revision })" class="btn btn-default">@BuildFeed.Local.Front.ReturnToOverview</a>
|
||||
<a href="@Url.Action("ViewGroup", new { major = Model.MajorVersion, minor = Model.MinorVersion, number = Model.Number, revision = Model.Revision })" class="btn btn-default">@BuildFeed.Local.Front.ReturnToOverview</a>
|
||||
 
|
||||
<a href="@Url.Action("index")" class="btn btn-default">@BuildFeed.Local.Front.ReturnToListing</a>
|
||||
<a href="@Url.Action("Index")" class="btn btn-default">@BuildFeed.Local.Front.ReturnToListing</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">@BuildFeed.Local.Front.Edit</a>
|
||||
@if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
<a href="@Url.Action("DeleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">@BuildFeed.Local.Front.Edit</a>
|
||||
@if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
<a href="@Url.Action("DeleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">@BuildFeed.Local.Front.Edit</a>
|
||||
@if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
<a href="@Url.Action("DeleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">@BuildFeed.Local.Front.Edit</a>
|
||||
@if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
<a href="@Url.Action("DeleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">@BuildFeed.Local.Front.Edit</a>
|
||||
@if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
<a href="@Url.Action("DeleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">@BuildFeed.Local.Front.Delete</a>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
@Html.ActionLink(BuildFeed.Local.Common.SiteName, "index", new { controller = "front", area = "" }, new { @class = "navbar-brand" })
|
||||
@Html.ActionLink(BuildFeed.Local.Common.SiteName, "Index", new { controller = "Front", area = "" }, new { @class = "navbar-brand" })
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="page-navigation-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
@ -71,12 +71,12 @@
|
|||
else if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
<li><a href="@Url.Action("index", new { controller = "base", area = "admin" })" title="@BuildFeed.Local.Common.Admin"><i class="fa fa-fw fa-cogs"></i> @BuildFeed.Local.Common.Admin</a></li>
|
||||
<li><a href="@Url.Action("addBuild", new { controller = "front", area = "" })" title="@BuildFeed.Local.Common.AddBuild"><i class="fa fa-fw fa-plus-square"></i> @BuildFeed.Local.Common.AddBuild</a></li>
|
||||
<li><a href="@Url.Action("addBuild", new { controller = "Front", area = "" })" title="@BuildFeed.Local.Common.AddBuild"><i class="fa fa-fw fa-plus-square"></i> @BuildFeed.Local.Common.AddBuild</a></li>
|
||||
<li><a href="@Url.Action("logout", new { controller = "support", area = "" })" title="@BuildFeed.Local.Common.LogOut"><i class="fa fa-fw fa-user"></i> @BuildFeed.Local.Common.LogOut</a></li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li><a href="@Url.Action("addBuild", new { controller = "front", area = "" })" title="@BuildFeed.Local.Common.AddBuild"><i class="fa fa-fw fa-plus-square"></i> @BuildFeed.Local.Common.AddBuild</a></li>
|
||||
<li><a href="@Url.Action("addBuild", new { controller = "Front", area = "" })" title="@BuildFeed.Local.Common.AddBuild"><i class="fa fa-fw fa-plus-square"></i> @BuildFeed.Local.Common.AddBuild</a></li>
|
||||
<li><a href="@Url.Action("logout", new { controller = "support", area = "" })" title="@BuildFeed.Local.Common.LogOut"><i class="fa fa-fw fa-user"></i> @BuildFeed.Local.Common.LogOut</a></li>
|
||||
}
|
||||
<li><a href="#" id="page-navigation-search" title="@BuildFeed.Local.Common.Search"><i class="fa fa-fw fa-search"></i> @BuildFeed.Local.Common.Search</a></li>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<nav id="page-navigation" role="navigation">
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="container">
|
||||
@Html.ActionLink(@BuildFeed.Local.Common.SiteName, "index", new { controller = "front", area = "" }, new { @class = "navbar-brand" })
|
||||
@Html.ActionLink(@BuildFeed.Local.Common.SiteName, "Index", new { controller = "Front", area = "" }, new { @class = "navbar-brand" })
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="https://twitter.com/buildfeed" title="@BuildFeed.Local.Common.Twitter" target="_blank"><i class="fa fa-twitter"></i> @BuildFeed.Local.Common.Twitter</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
@foreach (var buildGroup in Model.Builds)
|
||||
{
|
||||
<li>
|
||||
@Html.ActionLink(buildGroup.Id.ToString(), "viewGroup", new { controller = "front", major = buildGroup.Id.Major, minor = buildGroup.Id.Minor, number = buildGroup.Id.Build, revision = buildGroup.Id.Revision })
|
||||
@Html.ActionLink(buildGroup.Id.ToString(), "ViewGroup", new { controller = "Front", major = buildGroup.Id.Major, minor = buildGroup.Id.Minor, number = buildGroup.Id.Build, revision = buildGroup.Id.Revision })
|
||||
<ul>
|
||||
@foreach (var build in buildGroup.Builds)
|
||||
{
|
||||
<li>@Html.ActionLink(build.Name, "viewBuild", new { controller = "front", id = build.Id })</li>
|
||||
<li>@Html.ActionLink(build.Name, "viewBuild", new { controller = "Front", id = build.Id })</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue
Block a user