@{
ViewBag.Title = "Manage users | BuildFeed";
@@ -54,24 +54,18 @@
@Html.DisplayFor(modelItem => mu.LastLockoutDate)
- @if (mu.IsApproved)
- {
- @Html.ActionLink("Unapprove", "unapprove", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" })
- }
- else
- {
- @Html.ActionLink("Approve", "approve", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
- }
+ @(
+ mu.IsApproved ?
+ Html.ActionLink("Unapprove", "unapprove", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" }) :
+ Html.ActionLink("Approve", "approve", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
+ )
|
- @if (!mu.IsLockedOut)
- {
- @Html.ActionLink("Lock", "lock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" })
- }
- else
- {
- @Html.ActionLink("Unlock", "unlock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
- }
+ @(
+ !mu.IsLockedOut ?
+ Html.ActionLink("Lock", "lock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" }) :
+ Html.ActionLink("Unlock", "unlock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
+ )
|
}
diff --git a/BuildFeed/Areas/admin/Views/web.config b/BuildFeed/Areas/admin/Views/web.config
index 818e6c3..e5ca57d 100644
--- a/BuildFeed/Areas/admin/Views/web.config
+++ b/BuildFeed/Areas/admin/Views/web.config
@@ -18,7 +18,6 @@
-
diff --git a/BuildFeed/Areas/admin/adminAreaRegistration.cs b/BuildFeed/Areas/admin/adminAreaRegistration.cs
index 66fcb8a..6669cb9 100644
--- a/BuildFeed/Areas/admin/adminAreaRegistration.cs
+++ b/BuildFeed/Areas/admin/adminAreaRegistration.cs
@@ -4,13 +4,7 @@ namespace BuildFeed.Areas.admin
{
public class adminAreaRegistration : AreaRegistration
{
- public override string AreaName
- {
- get
- {
- return "admin";
- }
- }
+ public override string AreaName => "admin";
public override void RegisterArea(AreaRegistrationContext context)
{
diff --git a/BuildFeed/BuildFeed.csproj b/BuildFeed/BuildFeed.csproj
index 3665c40..3cde90a 100644
--- a/BuildFeed/BuildFeed.csproj
+++ b/BuildFeed/BuildFeed.csproj
@@ -24,7 +24,7 @@
/subscriptions/4af45631-0e5c-4253-9e38-d0c47f9c5b32/resourcegroups/Default-ApplicationInsights-CentralUS/providers/microsoft.insights/components/BuildFeed
- 1.4
+ 1.5
diff --git a/BuildFeed/Code/DateTimeModelBinder.cs b/BuildFeed/Code/DateTimeModelBinder.cs
index 17430c9..08b2e47 100644
--- a/BuildFeed/Code/DateTimeModelBinder.cs
+++ b/BuildFeed/Code/DateTimeModelBinder.cs
@@ -16,7 +16,7 @@ public override object BindModel(ControllerContext controllerContext, ModelBindi
success = DateTime.TryParseExact(value.AttemptedValue, "yyMMdd-HHmm", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out retValue);
}
- return success ? retValue as DateTime? : null as DateTime?;
+ return success ? retValue as DateTime? : null;
}
}
}
\ No newline at end of file
diff --git a/BuildFeed/Code/DisplayHelpers.cs b/BuildFeed/Code/DisplayHelpers.cs
index 04c8066..25e032e 100644
--- a/BuildFeed/Code/DisplayHelpers.cs
+++ b/BuildFeed/Code/DisplayHelpers.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace BuildFeed
@@ -8,8 +7,8 @@ public static class DisplayHelpers
{
public static string GetDisplayTextForEnum(object o)
{
- var result = null as string;
- var display = o.GetType()
+ string result = null as string;
+ DisplayAttribute display = o.GetType()
.GetMember(o.ToString()).First()
.GetCustomAttributes(false)
.OfType()
diff --git a/BuildFeed/Code/MvcIntrinsics.cs b/BuildFeed/Code/MvcIntrinsics.cs
index 210d334..1da4787 100644
--- a/BuildFeed/Code/MvcIntrinsics.cs
+++ b/BuildFeed/Code/MvcIntrinsics.cs
@@ -1,17 +1,14 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
+using System.Web.Mvc;
using System.Web.WebPages;
namespace BuildFeed.Code
{
public static class MvcIntrinsics
{
- public static System.Web.Mvc.HtmlHelper Html => ((System.Web.Mvc.WebViewPage) WebPageContext.Current.Page).Html;
+ public static HtmlHelper Html => ((WebViewPage) WebPageContext.Current.Page).Html;
- public static System.Web.Mvc.AjaxHelper Ajax => ((System.Web.Mvc.WebViewPage) WebPageContext.Current.Page).Ajax;
+ public static AjaxHelper Ajax => ((WebViewPage) WebPageContext.Current.Page).Ajax;
- public static System.Web.Mvc.UrlHelper Url => ((System.Web.Mvc.WebViewPage) WebPageContext.Current.Page).Url;
+ public static UrlHelper Url => ((WebViewPage) WebPageContext.Current.Page).Url;
}
}
\ No newline at end of file
diff --git a/BuildFeed/Controllers/frontController.cs b/BuildFeed/Controllers/frontController.cs
index eebd250..e087cae 100644
--- a/BuildFeed/Controllers/frontController.cs
+++ b/BuildFeed/Controllers/frontController.cs
@@ -1,13 +1,13 @@
-using BuildFeed.Code;
-using BuildFeed.Models;
-using BuildFeed.Models.ViewModel.Front;
-using System;
+using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Linq;
using System.Web.Mvc;
+using BuildFeed.Code;
+using BuildFeed.Models;
+using BuildFeed.Models.ViewModel.Front;
namespace BuildFeed.Controllers
{
@@ -19,10 +19,7 @@ public class frontController : Controller
#if !DEBUG
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
#endif
- public ActionResult index()
- {
- return indexPage(1);
- }
+ public ActionResult index() { return indexPage(1); }
[Route("page-{page:int:min(2)}/", Order = 0)]
#if !DEBUG
@@ -31,23 +28,24 @@ public ActionResult index()
public ActionResult indexPage(int page)
{
var buildGroups = (from b in Build.Select()
- group b by new BuildGroup()
- {
- 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 FrontBuildGroup()
- {
- Key = bg.Key,
- LastBuild = bg.Max(m => m.BuildTime),
- BuildCount = bg.Count()
- }).ToArray();
+ group b by new BuildGroup
+ {
+ 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 FrontBuildGroup
+ {
+ Key = bg.Key,
+ LastBuild = bg.Max(m => m.BuildTime),
+ BuildCount = bg.Count()
+ }).ToArray();
ViewBag.PageNumber = page;
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(buildGroups.Length) / Convert.ToDouble(PAGE_SIZE));
@@ -67,13 +65,14 @@ bg.Key.Revision descending
public ActionResult viewGroup(byte major, byte minor, ushort number, ushort? revision = null)
{
var builds = (from b in Build.Select()
- group b by new BuildGroup()
- {
- Major = b.MajorVersion,
- Minor = b.MinorVersion,
- Build = b.Number,
- Revision = b.Revision
- } into bg
+ group b by new BuildGroup
+ {
+ Major = b.MajorVersion,
+ Minor = b.MinorVersion,
+ Build = b.Number,
+ Revision = b.Revision
+ }
+ into bg
where bg.Key.Major == major
where bg.Key.Minor == minor
where bg.Key.Build == number
@@ -81,8 +80,8 @@ public ActionResult viewGroup(byte major, byte minor, ushort number, ushort? rev
select bg).Single();
return builds.Count() == 1 ?
- RedirectToAction("viewBuild", new { id = builds.Single().Id }) as ActionResult :
- View(builds);
+ RedirectToAction("viewBuild", new {id = builds.Single().Id}) as ActionResult :
+ View(builds);
}
[Route("build/{id}/", Name = "Build")]
@@ -105,25 +104,27 @@ public ActionResult twitterCard(long id)
Build b = Build.SelectById(id);
using (Bitmap bm = new Bitmap(560, 300))
- using (Graphics gr = Graphics.FromImage(bm))
{
- GraphicsPath gp = new GraphicsPath();
- gr.CompositingMode = CompositingMode.SourceOver;
- gr.CompositingQuality = CompositingQuality.HighQuality;
- gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
- gr.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
- gr.SmoothingMode = SmoothingMode.HighQuality;
- gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
+ using (Graphics gr = Graphics.FromImage(bm))
+ {
+ GraphicsPath gp = new GraphicsPath();
+ gr.CompositingMode = CompositingMode.SourceOver;
+ gr.CompositingQuality = CompositingQuality.HighQuality;
+ gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ gr.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
+ gr.SmoothingMode = SmoothingMode.HighQuality;
+ gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
- gr.FillRectangle(new SolidBrush(Color.FromArgb(0x30, 0x30, 0x30)), 0, 0, 560, 300);
- gp.AddString("BUILDFEED", new FontFamily("Segoe UI"), (int)FontStyle.Bold, 16, new Point(20, 20), StringFormat.GenericTypographic);
- gp.AddString($"Windows NT {b.MajorVersion}.{b.MinorVersion} build", new FontFamily("Segoe UI"), 0, 24, new Point(20, 40), StringFormat.GenericTypographic);
- gp.AddString(b.Number.ToString(), new FontFamily("Segoe UI Light"), 0, 180, new Point(12, 20), StringFormat.GenericTypographic);
- gp.AddString($"{b.Lab}", new FontFamily("Segoe UI"), 0, 40, new Point(16, 220), StringFormat.GenericTypographic);
- gr.FillPath(Brushes.White, gp);
+ gr.FillRectangle(new SolidBrush(Color.FromArgb(0x30, 0x30, 0x30)), 0, 0, 560, 300);
+ gp.AddString("BUILDFEED", new FontFamily("Segoe UI"), (int) FontStyle.Bold, 16, new Point(20, 20), StringFormat.GenericTypographic);
+ gp.AddString($"Windows NT {b.MajorVersion}.{b.MinorVersion} build", new FontFamily("Segoe UI"), 0, 24, new Point(20, 40), StringFormat.GenericTypographic);
+ gp.AddString(b.Number.ToString(), new FontFamily("Segoe UI Light"), 0, 180, new Point(12, 20), StringFormat.GenericTypographic);
+ gp.AddString($"{b.Lab}", new FontFamily("Segoe UI"), 0, 40, new Point(16, 220), StringFormat.GenericTypographic);
+ gr.FillPath(Brushes.White, gp);
- Response.ContentType = "image/png";
- bm.Save(Response.OutputStream, ImageFormat.Png);
+ Response.ContentType = "image/png";
+ bm.Save(Response.OutputStream, ImageFormat.Png);
+ }
}
return new EmptyResult();
@@ -133,10 +134,7 @@ public ActionResult twitterCard(long id)
#if !DEBUG
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
#endif
- public ActionResult viewLab(string lab)
- {
- return viewLabPage(lab, 1);
- }
+ public ActionResult viewLab(string lab) { return viewLabPage(lab, 1); }
[Route("lab/{lab}/page-{page:int:min(2)}/", Order = 0)]
#if !DEBUG
@@ -144,7 +142,11 @@ public ActionResult viewLab(string lab)
#endif
public ActionResult viewLabPage(string lab, int page)
{
- ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Lab, Value = lab });
+ ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
+ {
+ Type = MetaType.Lab,
+ Value = lab
+ });
ViewBag.ItemId = lab;
var builds = Build.SelectInBuildOrder().Where(b => b.Lab != null && (b.Lab.ToLower() == lab.ToLower())).ToArray();
@@ -164,10 +166,7 @@ public ActionResult viewLabPage(string lab, int page)
#if !DEBUG
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
#endif
- public ActionResult viewSource(TypeOfSource source)
- {
- return viewSourcePage(source, 1);
- }
+ public ActionResult viewSource(TypeOfSource source) { return viewSourcePage(source, 1); }
[Route("source/{source}/page-{page:int:min(2)}/", Order = 0)]
#if !DEBUG
@@ -175,7 +174,11 @@ public ActionResult viewSource(TypeOfSource source)
#endif
public ActionResult viewSourcePage(TypeOfSource source, int page)
{
- ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Source, Value = source.ToString() });
+ ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
+ {
+ Type = MetaType.Source,
+ Value = source.ToString()
+ });
ViewBag.ItemId = DisplayHelpers.GetDisplayTextForEnum(source);
var builds = Build.SelectInBuildOrder().Where(b => b.SourceType == source).ToArray();
@@ -195,10 +198,7 @@ public ActionResult viewSourcePage(TypeOfSource source, int page)
#if !DEBUG
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
#endif
- public ActionResult viewYear(int year)
- {
- return viewYearPage(year, 1);
- }
+ public ActionResult viewYear(int year) { return viewYearPage(year, 1); }
[Route("year/{year}/page-{page:int:min(2)}/", Order = 0)]
#if !DEBUG
@@ -206,7 +206,11 @@ public ActionResult viewYear(int year)
#endif
public ActionResult viewYearPage(int year, int page)
{
- ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Year, Value = year.ToString() });
+ ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
+ {
+ Type = MetaType.Year,
+ Value = year.ToString()
+ });
ViewBag.ItemId = year.ToString();
var builds = Build.SelectInBuildOrder().Where(b => b.BuildTime.HasValue && b.BuildTime.Value.Year == year).ToArray();
@@ -226,10 +230,7 @@ public ActionResult viewYearPage(int year, int page)
#if !DEBUG
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
#endif
- public ActionResult viewVersion(int major, int minor)
- {
- return viewVersionPage(major, minor, 1);
- }
+ public ActionResult viewVersion(int major, int minor) { return viewVersionPage(major, minor, 1); }
[Route("version/{major}.{minor}/page-{page:int:min(2)}/", Order = 0)]
#if !DEBUG
@@ -238,7 +239,11 @@ public ActionResult viewVersion(int major, int minor)
public ActionResult viewVersionPage(int major, int minor, int page)
{
string valueString = $"{major}.{minor}";
- ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Version, Value = valueString });
+ ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
+ {
+ Type = MetaType.Version,
+ Value = valueString
+ });
ViewBag.ItemId = valueString;
var builds = Build.SelectInBuildOrder().Where(b => b.MajorVersion == major && b.MinorVersion == minor).ToArray();
@@ -255,10 +260,7 @@ public ActionResult viewVersionPage(int major, int minor, int page)
}
[Route("add/"), Authorize]
- public ActionResult addBuild()
- {
- return View("editBuild");
- }
+ public ActionResult addBuild() { return View("editBuild"); }
[Route("add/"), Authorize, HttpPost]
public ActionResult addBuild(Build build)
@@ -275,12 +277,12 @@ public ActionResult addBuild(Build build)
{
return View("editBuild", build);
}
- return RedirectToAction("viewBuild", new { id = build.Id });
- }
- else
- {
- return View("editBuild", build);
+ return RedirectToAction("viewBuild", new
+ {
+ id = build.Id
+ });
}
+ return View("editBuild", build);
}
[Route("edit/{id}/"), Authorize]
@@ -306,10 +308,7 @@ public ActionResult editBuild(long id, Build build)
return RedirectToAction("viewBuild", new { id = build.Id });
}
- else
- {
- return View(build);
- }
+ return View(build);
}
[Route("delete/{id}/"), Authorize(Roles = "Administrators")]
diff --git a/BuildFeed/Controllers/supportController.cs b/BuildFeed/Controllers/supportController.cs
index 0ebe54e..27cdfbc 100644
--- a/BuildFeed/Controllers/supportController.cs
+++ b/BuildFeed/Controllers/supportController.cs
@@ -32,10 +32,10 @@ public ActionResult login(LoginUser ru)
var ticket = new FormsAuthenticationTicket(ru.UserName, true, expiryLength);
var encryptedTicket = FormsAuthentication.Encrypt(ticket);
var cookieTicket = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
- {
- Expires = DateTime.Now.AddMinutes(expiryLength),
- Path = FormsAuthentication.FormsCookiePath
- };
+ {
+ Expires = DateTime.Now.AddMinutes(expiryLength),
+ Path = FormsAuthentication.FormsCookiePath
+ };
Response.Cookies.Add(cookieTicket);
string returnUrl = string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]) ? "/" : Request.QueryString["ReturnUrl"];
@@ -142,7 +142,7 @@ public ActionResult sitemap()
Dictionary actions = new Dictionary
{
{
- "Pages", new SitemapPagedAction[]
+ "Pages", new[]
{
new SitemapPagedAction()
{
@@ -325,14 +325,18 @@ public ActionResult stats()
List additions = new List();
var rawAdditions = (from b in builds
- where b.Added > DateTime.Now.AddYears(-1)
- group b by new { Year = b.Added.Year, Week = Convert.ToInt32(Math.Floor(b.Added.DayOfYear / 7m)) } into bm
- select new MonthCount()
- {
- Month = bm.Key.Week,
- Year = bm.Key.Year,
- Count = bm.Count()
- }).ToArray();
+ where b.Added > DateTime.Now.AddYears(-1)
+ group b by new
+ {
+ Year = b.Added.Year,
+ Week = Convert.ToInt32(Math.Floor(b.Added.DayOfYear / 7m))
+ } into bm
+ select new MonthCount()
+ {
+ Month = bm.Key.Week,
+ Year = bm.Key.Year,
+ Count = bm.Count()
+ }).ToArray();
for (int i = -52; i <= 0; i++)
{
@@ -348,7 +352,11 @@ public ActionResult stats()
List compiles = new List();
var rawCompiles = from b in builds
where b.BuildTime.HasValue
- group b by new { Year = b.BuildTime.Value.Year, Month = Convert.ToInt32(Math.Floor((b.BuildTime.Value.Month - 0.1m) / 3m) * 3) + 1 } into bm
+ group b by new
+ {
+ Year = b.BuildTime.Value.Year,
+ Month = Convert.ToInt32(Math.Floor((b.BuildTime.Value.Month - 0.1m) / 3m) * 3) + 1
+ } into bm
select new MonthCount()
{
Month = bm.Key.Month,
diff --git a/BuildFeed/Views/front/viewGroup.cshtml b/BuildFeed/Views/front/viewGroup.cshtml
index d9a8504..7fc7961 100644
--- a/BuildFeed/Views/front/viewGroup.cshtml
+++ b/BuildFeed/Views/front/viewGroup.cshtml
@@ -32,11 +32,11 @@
@if (build.IsLeaked)
{
- Leaked
+ Public
}
else
{
- Unleaked
+ Private
}