public TrainingPlanMutation(ITrainingPlanService trainingPlanService) { Field <TrainingPlanType>( "createPlan", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "name", Description = "Name of the training plan" }, new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "weeks", Description = "Weeks" }, new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "daysBreak", Description = "Days break" } ), resolve: context => trainingPlanService.Create(context.GetArgument <string>("name"), context.GetArgument <int>("weeks"), context.GetArgument <int>("daysBreak")) ); }
public IActionResult Post([FromBody] CreateTrainingPlan request) { var plan = _trainingPlanService.Create(request.Name, request.Weeks, request.DaysBreak); return(Created($"http://localhost:5000/training-plans/{plan.Id}", new object())); }
private void AddPlans() { _trainingPlanService.Create("stronglifts", 30, 2); _trainingPlanService.Create("smolov jr", 12, 3); _trainingPlanService.Create("5x5", 20, 2); }