public async Task <IActionResult> StartBot(int Id) { try { Models.User user = await db.Users.Include(x => x.Bots).ThenInclude(x => x.BotQueries) .ThenInclude(x => x.Response).FirstAsync(x => x.Name == User.Identity.Name); TelegramBot model; model = user.Bots.First(x => x.Id == Id); model.IsStarted = true; db.Bots.Update(model); await db.SaveChangesAsync(); BotHandler.StartHandleAsync(model); return(new NoContentResult()); } catch (ArgumentException e) { return(View("Error", new ErrorModel("Bad bot token"))); } }