Пример #1
0
        public async Task <LecturerNotification> Handle(LecturerUpdateCommand request, CancellationToken cancellationToken)
        {
            string fullName = request.lecturer.FirstName + " " + request.lecturer.LastName;

            try
            {
                await _repository.Edit(request.lecturer);

                var result = new LecturerNotification()
                {
                    lecturer = request.lecturer, message = $"Lecturer {fullName} was created successful."
                };

                await _mediator.Publish(result);

                return(await Task.FromResult(result));
            }
            catch
            {
                var result = new LecturerNotification()
                {
                    lecturer = request.lecturer, message = $"Some thing is wrong cannot create the lecturer {fullName}."
                };

                return(await Task.FromResult(result));
            }
        }