public ActionResult <MonsterCollection> Get(string id) { var item = _monsterService.Get(id); if (item == null) { return(NotFound()); } return(item); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserService userService, LieutenantService lieutenantService, MonsterService monsterService) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseCors("ApiPolicy"); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); // Load users IList <User> userList = userService.Get(); foreach (var user in userList) { user.Lieutenants = new List <Lieutenant>(); user.Monsters = new List <Monster>(); user.Character.CurrentHealth = 0; user.Character.CurrentStamina = 0; user.Character.HeroicFeatUsed = false; } GameHandler.Users = userList; IList <Lieutenant> lieutenants = lieutenantService.Get(); IList <Monster> monsters = monsterService.Get(); GameHandler.Lieutenants = lieutenants; GameHandler.Monsters = monsters; }
public ActionResult <List <Monster> > Get() => _monsterService.Get();