public ICommandResult Handle(DeleteRecomendationCommand command) { //Fail Fast Validation command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, Messages.Ex_ExceptionGeneric, command.Notifications)); } var recomendation = _repository.GetById(command.Id); if (recomendation == null) { return(new GenericCommandResult(false, Messages.Ex_ItemNotFound.ToFormat(command.Id.ToString() ?? ""), command.Notifications)); } _repository.Delete(recomendation); return(new GenericCommandResult(true, Messages.Act_Deleted, recomendation)); }
public GenericCommandResult Delete([FromBody] DeleteRecomendationCommand command, [FromServices] RecomendationHandler handler) { return((GenericCommandResult)handler.Handle(command)); }