Permalink
Switch branches/tags
Nothing to show
Find file Copy path
cdc2f3f Apr 18, 2018
1 contributor

Users who have contributed to this file

28 lines (24 sloc) 737 Bytes
using GraphQL.Types;
using NHLStats.Core.Data;
using NHLStats.Core.Models;
namespace NHLStats.Api.Models
{
public class NHLStatsMutation : ObjectGraphType
{
public NHLStatsMutation(IPlayerRepository playerRepository)
{
Name = "CreatePlayerMutation";
Field<PlayerType>(
"createPlayer",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<PlayerInputType>> { Name = "player" }
),
resolve: context =>
{
var player = context.GetArgument<Player>("player");
return playerRepository.Add(player);
});
}
}
}