示例#1
0
        public ICommandResult Handle(UpdateRecomendationCommand command)
        {
            //Fail Fast Validation
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, Messages.Ex_ExceptionGeneric, command.Notifications));
            }

            var recomendation = _repository.GetById(command.Id);

            recomendation.UpdateRecomendation(command.Title, command.Url, command.Value, command.RecomendedByEid, command.IsApproved);

            _repository.Update(recomendation);

            return(new GenericCommandResult(true, Messages.Act_Update, recomendation));
        }
示例#2
0
 public GenericCommandResult Update([FromBody] UpdateRecomendationCommand command, [FromServices] RecomendationHandler handler)
 {
     return((GenericCommandResult)handler.Handle(command));
 }