public async Task <IActionResult> GetBanHistory([FromBody] SelectCharacterByGuidModel model) { var context = _contextService.GetCharacterContext(model.RealmType); var history = await context.CharacterBanned.Where(x => x.CharacterId == model.Guid).ToListAsync(); return(Ok(history)); }
public async Task <IActionResult> GetCharacterStats([FromBody] SelectCharacterByGuidModel model) { var characterContext = _contextService.GetCharacterContext(model.RealmType); var stats = await characterContext.CharacterStats.FirstOrDefaultAsync(x => x.Guid == model.Guid); var currencies = await characterContext.CharacterCurrencies.FirstOrDefaultAsync(x => x.Guid == model.Guid); return(Ok(new { stats, currencies })); }
public async Task <IActionResult> GetCharacterItems([FromBody] SelectCharacterByGuidModel model) { var characterContext = _contextService.GetCharacterContext(model.RealmType); var inventory = await characterContext.ItemInstance.Where(x => x.OwnerGuid == model.Guid).Select(x => new InventoryModel { ItemEntry = x.ItemEntry, ItemCount = x.Count, ItemGuid = x.Guid }).ToListAsync(); var mappedInventory = model.RealmType == RealmType.TitansLeague ? await _itemMapperService.MapCustomInventory(model.RealmType, inventory, model.Guid) : await _itemMapperService.MapInventory(model.RealmType, inventory); return(Ok(mappedInventory)); }
public async Task <IActionResult> GetCharacterInventory([FromBody] SelectCharacterByGuidModel model) { var characterContext = _contextService.GetCharacterContext(model.RealmType); var inventory = await characterContext.CharacterInventory .Where(x => x.Guid == model.Guid && x.Slot < (int)EquipmentSlots.EQUIPMENT_SLOT_END && x.Bag == 0) .Join(characterContext.ItemInstance, ci => ci.Item, i => i.Guid, (ci, i) => new { ci, i }) .Select(x => new InventoryModel { Slot = x.ci.Slot, ItemEntry = x.i.ItemEntry, ItemGuid = x.i.Guid }).OrderBy(o => o.Slot).ToListAsync(); var mappedInventory = model.RealmType == RealmType.TitansLeague ? await _itemMapperService.MapCustomInventory(model.RealmType, inventory, model.Guid) : await _itemMapperService.MapInventory(model.RealmType, inventory); return(Ok(mappedInventory)); }
public async Task <IActionResult> GetGuildByCharacter([FromBody] SelectCharacterByGuidModel model) { var context = _contextService.GetCharacterContext(model.RealmType); var member = await context.GuildMembers.FirstOrDefaultAsync(x => x.CharacterId == model.Guid); if (member == null) { return(RequestHandler.BadRequest("This character is not in any guild")); } var guild = await context.Guilds.FirstOrDefaultAsync(x => x.Id == member.GuildId); if (guild == null) { return(RequestHandler.BadRequest($"No Guild with id {member.GuildId} exists")); } return(Ok(guild)); }