Ejemplo n.º 1
0
        public async Task <ResultStatus> Handle(AddAuthorCommand request, CancellationToken cancellationToken, RequestHandlerDelegate <ResultStatus> next)
        {
            if (await _read.IsEmailExist(request.Email.Trim().ToLower()))
            {
                Log.Error("EmailExist " + request.Email.Trim().ToLower());
                return(ResultStatus.EmailExist);
            }



            if (await _read.IsUserNameExist(request.UserName.Trim().ToLower()))
            {
                Log.Error("UserNameExist " + request.UserName.Trim().ToLower());

                return(ResultStatus.UserNameExist);
            }

            return(await next());
        }
Ejemplo n.º 2
0
        public async Task <ResultStatus> Handle(AddAuthorCommand request, CancellationToken cancellationToken, RequestHandlerDelegate <ResultStatus> next)
        {
            if (await _read.IsEmailExist(request.Email.Trim().ToLower()))
            {
                Log.ForContext("Message", request)
                .ForContext("Error", "EmailIsExist").Error($"Error: ** {request}");
                return(ResultStatus.EmailExist);
            }



            if (await _read.IsUserNameExist(request.UserName.Trim().ToLower()))
            {
                Log.ForContext("Message", request)
                .ForContext("Error", "UserNameIsExist")
                .Error($"Error: ** {request}");
                return(ResultStatus.UserNameExist);
            }

            return(await next());
        }