public async Task <IActionResult> Index() { var userId = await _user.GetUserAsync(this.User); await _tasksService.CheckGatheringTaskCompletion(userId.Id); if (_manager.IsSignedIn(this.User)) { var model = new CharacterViewModel { Id = _user.GetUserId(this.User), Username = this.User.Identity.Name, Health = _db.ApplicationUsers.FirstOrDefault(x => x.Id == _user.GetUserId(this.User)).Health, Materials = _db.Materials.Where(x => x.UserId == _user.GetUserId(this.User)).ToList(), Armors = _db.Armors.ToList(), Weapons = _db.Weapons.ToList(), }; return(this.View(model)); } return(this.Redirect("/")); }
public async Task <IActionResult> Index(string craft) { var userId = await _user.GetUserAsync(this.User); await _tasksService.CheckGatheringTaskCompletion(userId.Id); if (!Enum.IsDefined(typeof(ArmorTypes), craft) && craft != "Weapons") { return(this.BadRequest("Page not found.")); } var model = _blacksmithService.CreateCraftableModel(craft, _user.GetUserId(this.User)); return(this.View(model)); }