Пример #1
0
 public IActionResult Create(Person person)
 {
     if (ModelState.IsValid)
     {
         _peopleService.CreatePerson(person);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(person));
 }
Пример #2
0
        public ActionResult Create(PersonN person)
        {
            try
            {
                _peopleService.CreatePerson(person);
            }
            catch (Exception)
            {
                return(View("NotFound"));
            }

            return(RedirectToAction("Index"));
        }
Пример #3
0
 public ActionResult <PersonDto> Post([FromBody] PersonDto person)
 {
     return(_peopleService.CreatePerson(person));
 }
Пример #4
0
 public async Task Handle(AddPersonCommand message, IMessageHandlerContext context)
 {
     await _peopleService.CreatePerson(message.Person);
 }
Пример #5
0
        public async Task <IActionResult> CreatePerson(CreatePersonCommand command)
        {
            long id = await _peopleService.CreatePerson(command);

            return(Created(Url.Link(nameof(GetPerson), new { id }), new { Id = id }));
        }