public IActionResult Create(Human human) { if (ModelState.IsValid) { _humanRepository.AddHuman(human); } return(RedirectToRoute(new { controller = "Human", action = "Index" })); }
public IActionResult Create(HumanCreateViewModel humanCreateViewModel) { if (ModelState.IsValid) { _humanRepository.AddHuman(humanCreateViewModel.Human); } return(View()); }
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)); }); }
public async Task AddHuman(AddHumanRequest request) { var human = _mapper.Map <AddHumanRequest, Human>(request); await _repository.AddHuman(human); }