Exemplo n.º 1
0
        async public static Task <(HttpStatusCodeResult result, Gladiator opponent)> EditOpponent(OpponentBindingModel model)
        {
            Opponent opponent = await GetGladiator(model.Id) as Opponent;

            if (opponent == null)
            {
                return(new HttpStatusCodeResult(404, "No opponent found."), null);
            }

            opponent.Update(model);
            db.Entry(opponent).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(new HttpStatusCodeResult(200, "Successfully Edited Gladiator."), opponent);
        }