code format

This commit is contained in:
2019-07-25 14:52:44 +02:00
parent 6eef36f249
commit d62caa048c

View File

@ -40,8 +40,9 @@ namespace Yavsc.Controllers
ViewBag.SecureHomeUrl = "https://" + Request.Headers["X-Forwarded-Host"]; ViewBag.SecureHomeUrl = "https://" + Request.Headers["X-Forwarded-Host"];
ViewBag.SshHeaderKey = Request.Headers[Constants.SshHeaderKey]; ViewBag.SshHeaderKey = Request.Headers[Constants.SshHeaderKey];
var uid = User.GetUserId(); var uid = User.GetUserId();
long [] clicked=null; long[] clicked = null;
if (uid==null) { if (uid == null)
{
await HttpContext.Session.LoadAsync(); await HttpContext.Session.LoadAsync();
var strclicked = HttpContext.Session.GetString("clicked"); var strclicked = HttpContext.Session.GetString("clicked");
if (strclicked != null) clicked = strclicked.Split(':').Select(c => long.Parse(c)).ToArray(); if (strclicked != null) clicked = strclicked.Split(':').Select(c => long.Parse(c)).ToArray();
@ -52,6 +53,7 @@ namespace Yavsc.Controllers
n => !clicked.Contains(n.Id) n => !clicked.Contains(n.Id)
); );
this.Notify(notes); this.Notify(notes);
ViewData["HaircutCommandCount"] = _dbContext.HairCutQueries.Where( ViewData["HaircutCommandCount"] = _dbContext.HairCutQueries.Where(
q => q.ClientId == uid && q.Status < QueryStatus.Failed q => q.ClientId == uid && q.Status < QueryStatus.Failed
).Count(); ).Count();
@ -63,7 +65,8 @@ namespace Yavsc.Controllers
.Where(a => a.ParentCode == id) .Where(a => a.ParentCode == id)
.OrderByDescending(a => a.Rate).ToList(); .OrderByDescending(a => a.Rate).ToList();
foreach (var a in toShow) { foreach (var a in toShow)
{
a.Children = a.Children.Where(c => !c.Hidden).ToList(); a.Children = a.Children.Where(c => !c.Hidden).ToList();
} }
return View(toShow); return View(toShow);
@ -89,12 +92,14 @@ namespace Yavsc.Controllers
public ActionResult Chat() public ActionResult Chat()
{ {
if (User.Identity.IsAuthenticated) { if (User.Identity.IsAuthenticated)
{
ViewBag.IsAuthenticated = true; ViewBag.IsAuthenticated = true;
string uid = User.GetUserId(); string uid = User.GetUserId();
ViewBag.Contacts = _dbContext.Contact.Where(c => c.OwnerId == uid) ViewBag.Contacts = _dbContext.Contact.Where(c => c.OwnerId == uid)
; ;
} else ViewBag.IsAuthenticated=false; }
else ViewBag.IsAuthenticated = false;
return View(); return View();
} }