Exemplo n.º 1
0
        public IActionResult Create(Human human)
        {
            if (ModelState.IsValid)
            {
                _humanRepository.AddHuman(human);
            }

            return(RedirectToRoute(new { controller = "Human", action = "Index" }));
        }
Exemplo n.º 2
0
        public IActionResult Create(HumanCreateViewModel humanCreateViewModel)
        {
            if (ModelState.IsValid)
            {
                _humanRepository.AddHuman(humanCreateViewModel.Human);
            }

            return(View());
        }
Exemplo n.º 3
0
        public RootMutation(IHumanRepository humanRepository)
        {
            this.Name        = "Mutation";
            this.Description = "The mutation type, represents all updates we can make to our data.";

            this.FieldAsync <HumanObject, Human>(
                "createHuman",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <HumanInputObject> >()
            {
                Name        = "human",
                Description = "The human you want to create."
            }),
                resolve: context =>
            {
                var human = context.GetArgument <Human>("human");
                return(humanRepository.AddHuman(human, context.CancellationToken));
            });
        }
Exemplo n.º 4
0
 public async Task AddHuman(AddHumanRequest request)
 {
     var human = _mapper.Map <AddHumanRequest, Human>(request);
     await _repository.AddHuman(human);
 }