Exemplo n.º 1
0
        public async Task <SpecialistModel> Handle(UpdateSpecialistCommand request, CancellationToken cancellationToken)
        {
            var specialist = await _repository.GetSpecialistByIdAsync(request.Id);

            specialist.Names          = request.Names;
            specialist.Surnames       = request.Surnames;
            specialist.LastModified   = DateTime.UtcNow;
            specialist.LastModifiedBy = "APPLICATION";

            long insertedId = await _repository.UpdateSpecialistAsync(specialist);

            specialist = await _repository.GetSpecialistByIdAsync(insertedId);

            return(new SpecialistModel()
            {
                Id = specialist.Id,
                Names = specialist.Names,
                Surnames = specialist.Surnames
            });
        }