forked from SoDOff-Project/sodoff
precense fixes
This commit is contained in:
parent
ded2acc5ca
commit
e0c1d2cab2
@ -14,12 +14,17 @@ namespace sodoff.Controllers.Common
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Route("Precense/SetVikingOnline")]
|
[Route("Precense/SetVikingOnline")]
|
||||||
[VikingSession]
|
public IActionResult SetVikingOnline([FromForm] Guid token, [FromForm] bool online)
|
||||||
public IActionResult SetVikingOnline(Viking viking, [FromForm] bool online)
|
{
|
||||||
|
// get viking from session
|
||||||
|
Viking? viking = ctx.Sessions.FirstOrDefault(e => e.ApiToken == token)?.Viking;
|
||||||
|
|
||||||
|
if (viking != null)
|
||||||
{
|
{
|
||||||
viking.Online = online;
|
viking.Online = online;
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
return Ok(viking.Online);
|
return Ok(viking.Online);
|
||||||
|
} else return Ok(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ public class ProfileController : Controller {
|
|||||||
GameCurrency = currency.GameCurrency,
|
GameCurrency = currency.GameCurrency,
|
||||||
CashCurrency = currency.CashCurrency,
|
CashCurrency = currency.CashCurrency,
|
||||||
ActivityCount = 0,
|
ActivityCount = 0,
|
||||||
BuddyCount = viking.BuddiesMade.Count,
|
BuddyCount = viking.BuddyList.Count + viking.BuddiesMade.Count, // relations are hard
|
||||||
UserGradeData = new UserGrade { UserGradeID = 0 },
|
UserGradeData = new UserGrade { UserGradeID = 0 },
|
||||||
UserProfileTag = new UserProfileTag() {
|
UserProfileTag = new UserProfileTag() {
|
||||||
CreateDate = new DateTime(DateTime.Now.Ticks),
|
CreateDate = new DateTime(DateTime.Now.Ticks),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user