public Result <User> Handle(GetByCommand cmd) { User user = null; if (cmd.username != "") { user = repo.GetByUserName(cmd.username); } if (cmd.id > 0) { user = repo.GetById(cmd.id); } if (user == null) { return(Result.FailWithDefaultReturnValue <User>($"No user found with: name: '{cmd.username}' or id: '{cmd.id}'")); } else { return(Result.SuccessWithReturnValue(user)); } }
public Result <User> FindBy(GetByCommand cmd) { var result = bus.SendCommand <GetByCommand, Result <User> >(cmd); return(result); }