/// <summary> /// Get a WizardUser object by id /// </summary> /// <param name="id">The id of the user to get</param> /// <param name="context">The context</param> /// <returns>WizardsUser object</returns> public static WizardsUser GetUser(int id, TheWizardsGameShopContext context) { var user = context.WizardsUser .Where(u => u.UserId.Equals(id)) .FirstOrDefault(); return(user); }
/// <summary> /// Get a WizardUser object by username /// </summary> /// <param name="userName">The username of the user to get</param> /// <param name="context">The context</param> /// <returns>WizardsUser object</returns> public static WizardsUser GetUser(string userName, TheWizardsGameShopContext context) { var user = context.WizardsUser .Where(u => u.UserName.Equals(userName)) .FirstOrDefault(); return(user); }
public static List <Relationship> getRequestsReceived(int?id, TheWizardsGameShopContext context) { if (id == null) { return(null); } var requests = context.Relationship.Include(r => r.SenderNavigation).Where(r => r.Receiver == id && !(bool)r.IsAccepted); return(requests.ToList()); }
/// <summary> /// Get the currently logged in user using the id stored in session /// </summary> /// <param name="ctr"></param> /// <param name="context">The context</param> /// <returns>WizardsUser object</returns> public static WizardsUser GetSessionUser(Controller ctr, TheWizardsGameShopContext context) { int?sessionUserId = ctr.HttpContext.Session.GetInt32("userId"); if (sessionUserId != null) { return(GetUser(Convert.ToInt32(sessionUserId), context)); } return(null); }
public UserRolesController(TheWizardsGameShopContext context) { _context = context; }
public OrderDetailsController(TheWizardsGameShopContext context) { _context = context; }
public GameCategoriesController(TheWizardsGameShopContext context) { _context = context; }
public ProvincesController(TheWizardsGameShopContext context) { _context = context; }
/// <summary> /// Check if a user with the given username exists /// </summary> /// <param name="userName">The username of the user to check</param> /// <returns>Whether the user exists</returns> public static bool UserExists(string userName, TheWizardsGameShopContext context) { return(context.WizardsUser.Any(e => e.UserName == userName)); }
public FavoritePlatformsController(TheWizardsGameShopContext context) { _context = context; }
public HomeController(ILogger <HomeController> logger, TheWizardsGameShopContext context) { _logger = logger; }
public RelationshipsController(TheWizardsGameShopContext context) { _context = context; }
public AddressesController(TheWizardsGameShopContext context) { _context = context; }
public RatingsController(TheWizardsGameShopContext context) { _context = context; }
public GameStatusesController(TheWizardsGameShopContext context) { _context = context; }
public ReviewsController(TheWizardsGameShopContext context) { _context = context; }
public GamesController(TheWizardsGameShopContext context, IWebHostEnvironment webHostEnvironment) { _context = context; _webHostEnvironment = webHostEnvironment; }
/// <summary> /// Check if a user with the given id exists /// </summary> /// <param name="id">The id of the user to check</param> /// <returns>Whether the user exists</returns> public static bool UserExists(int id, TheWizardsGameShopContext context) { return(context.WizardsUser.Any(e => e.UserId == id)); }
public CartsController(TheWizardsGameShopContext context) { _context = context; }
public GendersController(TheWizardsGameShopContext context) { _context = context; }
public static int countRequestsReceived(int?id, TheWizardsGameShopContext context) { return(id == null ? 0 : context.Relationship.Include(r => r.SenderNavigation).Where(r => r.Receiver == id && !(bool)r.IsAccepted).Count()); }