Users hand registered
This commit is contained in:
@@ -61,7 +61,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
{
|
{
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
public string gamerTag { get; set; }
|
public string gamerTag { get; set; }
|
||||||
public UserType user { get; set; }
|
public UserType? user { get; set; }
|
||||||
}
|
}
|
||||||
public class UserType
|
public class UserType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,9 +17,13 @@ namespace LaDOSE.Business.Service
|
|||||||
|
|
||||||
public int GetIdBySmash(ParticipantType participantUser)
|
public int GetIdBySmash(ParticipantType participantUser)
|
||||||
{
|
{
|
||||||
|
Player p = null;
|
||||||
//var p2 = _context.Player.ToList();
|
//var p2 = _context.Player.ToList();
|
||||||
|
if (participantUser.user != null)
|
||||||
var p = _context.Player.FirstOrDefault(e => e.SmashId == participantUser.user.id);
|
{
|
||||||
|
p = _context.Player.FirstOrDefault(e => e.SmashId == participantUser.user.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (p == null)
|
if (p == null)
|
||||||
{
|
{
|
||||||
@@ -28,15 +32,15 @@ namespace LaDOSE.Business.Service
|
|||||||
{
|
{
|
||||||
if (p.SmashId == null)
|
if (p.SmashId == null)
|
||||||
{
|
{
|
||||||
p.SmashId = participantUser.user.id;
|
p.SmashId = participantUser.user?.id;
|
||||||
}
|
}
|
||||||
return p.Id;
|
return p.Id;
|
||||||
}
|
}
|
||||||
var entity = new Player()
|
var entity = new Player()
|
||||||
{
|
{
|
||||||
Gamertag = participantUser.gamerTag,
|
Gamertag = participantUser.gamerTag,
|
||||||
Name = string.IsNullOrEmpty(participantUser.user.name)? participantUser.gamerTag : participantUser.user.name,
|
Name = string.IsNullOrEmpty(participantUser.user?.name)? participantUser.gamerTag : participantUser.user.name,
|
||||||
SmashId = participantUser.user.id,
|
SmashId = participantUser.user?.id,
|
||||||
};
|
};
|
||||||
_context.Player.Add(entity);
|
_context.Player.Add(entity);
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|||||||
Reference in New Issue
Block a user