public async Task <IActionResult> PutWarrior(long id, Warrior item)
        {
            System.Diagnostics.Debug.WriteLine("jo mama");
            if (id != item.Id)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
        private static void QueryAndUpdateWarriorDisconnected()
        {
            Warrior warrior;

            using (var context = new WarriorContext())
            {
                context.Database.Log = Console.WriteLine;
                warrior = context.Warriors.FirstOrDefault();
            }
            warrior.ServedInKingdom = (!warrior.ServedInKingdom);

            using (var context = new WarriorContext())
            {
                context.Database.Log = Console.WriteLine;
                context.Warriors.Add(warrior);
                context.Entry(warrior).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
        private static void DeleteWarrior()
        {
            Warrior warrior;

            using (var context = new WarriorContext())
            {
                context.Database.Log = Console.WriteLine;
                warrior = context.Warriors.FirstOrDefault();
                //context.Warriors.Remove(warrior);
                //context.SaveChanges();
            }
            using (var context = new WarriorContext())
            {
                context.Database.Log = Console.WriteLine;
                //context.Warriors.Attach(warrior);
                //context.Warriors.Remove(warrior);
                context.Entry(warrior).State = EntityState.Deleted;
                context.SaveChanges();
            }
        }