Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. final class MyController(TView) : Controller!TView
  2. {
  3. private:
  4. view_defaultview defaultview;
  5.  
  6. view_someotherview someotherview;
  7.  
  8. public:
  9. this(TView view)
  10. {
  11. super(view);
  12. }
  13.  
  14. @HttpMandatory Status mandatoryAction()
  15. {
  16. if (condition)
  17. {
  18. someotherview = view.getRaw!"someotherview";
  19. view = someotherview; // If you remove this, then it will already work, but "view" will always referre to defaultview
  20. }
  21.  
  22. return Status.success;
  23. }
  24.  
  25. @HttpDefault Status defaultAction()
  26. {
  27. // Don't use "view" directly. Use whichever view you need instead, unless it's generic functionality.
  28. if (someotherview)
  29. {
  30. ...
  31. }
  32. else
  33. {
  34. // use defaultview
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement