Ejemplo n.º 1
0
        public Task <ICommandResult> Handle(UpdatePersonCommand command, CancellationToken token)
        {
            // Pretend we have a database
            var person = GetPersonFromDb(command.Id);

            if (person == null)
            {
                return(Task.FromResult(_resultFactory.NotFound()));
            }

            person.FirstName = command.FirstName;
            person.LastName  = command.LastName;

            // We should save this back...

            return(Task.FromResult(_resultFactory.Ok(person)));
        }
Ejemplo n.º 2
0
        public ICommandResult Handle(UpdatePersonCommand command)
        {
            // Pretend we have a database
            var person = GetPersonFromDb(command.Id);

            if (person == null)
            {
                return(_resultFactory.NotFound());
            }

            person.FirstName = command.FirstName;
            person.LastName  = command.LastName;

            // We should save this back...

            return(_resultFactory.Ok(person));
        }