Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. public async Task<ActionResult> GetRMschools()
  2. {
  3. Account account = new Account("chr_coko.pto@mail.ru", "***");
  4. var api = new MailRuCloud();
  5. api.Account = account;
  6. string schoolID = User.Identity.Name;
  7. var items = await api.GetItems($@"/Reports/{schoolID}");
  8.  
  9. school school_current = schoolRepository.GetT(schoolID);
  10. List<RMschool> model = new List<RMschool>();
  11. foreach (var file_name in items.Files) //e.g. file_name = "0001_201636.zip"
  12. {
  13. int report_code = Convert.ToInt32(file_name.Name.Substring(5, 6)); //e.g. report_code = 201636
  14. var ob = monit95Context.ReportMetas.Find(report_code);
  15. model.Add(new RMschool
  16. {
  17. code = ob.code,
  18. name = ob.name,
  19. ProjectName = ob.ProjectName,
  20. year = ob.year,
  21. WWWref = $@"{school_current.ReportLink}/{file_name.Name}"
  22. });
  23. }
  24. return PartialView("_GetRMschools", model);
  25.  
  26. @using Monit95App.Models
  27. @model List<RMschool>
  28. <body>
  29. <table class="table">
  30. <thead class="thead-inverse">
  31. <tr>
  32. <th>Проект</th>
  33. <th>Отчет</th>
  34. <th>Учебный год</th>
  35. </tr>
  36. </thead>
  37. @foreach (var reportMeta in Model.OrderByDescending(x => x.code))
  38. {
  39. <tr>
  40. <td>@reportMeta.ProjectName</td>
  41. <td><a href="@reportMeta.WWWref">@reportMeta.name</a></td>
  42. <td>@reportMeta.year</td>
  43. </tr>
  44. }
  45. </table>
  46. </body>
  47.  
  48. <h2>Отчеты</h2>
  49. @Html.Action("GetRMschools")
  50.  
  51. [HttpGet]
  52. public async Task<ActionResult> Report()
  53. {
  54. var model = await GetRMschoolList(User.Identity.Name);
  55. return PartialView("_RMschool", model);
  56. }
  57.  
  58. public async Task<ActionResult> GetRMschoolPV(string _schoolID)
  59. {
  60. var model = await this.GetRMschoolList(_schoolID);
  61. return PartialView("_RMschool", model);
  62. }
  63.  
  64. public async Task<List<RMschool>> GetRMschoolList(string _schoolID) //GetViewModel
  65. {
  66. Account account = new Account("chr_coko.pto@mail.ru", "***");
  67. var api = new MailRuCloud();
  68. api.Account = account;
  69. var items = await api.GetItems($@"/Reports/{_schoolID}");
  70.  
  71. school school_current = schoolRepository.GetT(_schoolID);
  72. List<RMschool> model = new List<RMschool>();
  73. //du stuff
  74. return (model);
  75. }
  76.  
  77. @model IEnumerable<Monit95App.Models.RMschool>
  78.  
  79. @{ Html.RenderPartial("_RMschool", Model);}
  80.  
  81. @model IEnumerable<Monit95App.Models.RMschool>
  82.  
  83. <body>
  84. <table class="table">
  85. <thead class="thead-inverse">
  86. <tr>
  87. <th>Проект</th>
  88. <th>Отчет</th>
  89. <th>Учебный год</th>
  90. </tr>
  91. </thead>
  92. @foreach (var reportMeta in Model.OrderByDescending(x => x.code))
  93. {
  94. <tr>
  95. <td>@reportMeta.ProjectName</td>
  96. <td><a href="@reportMeta.WWWref">@reportMeta.name</a></td>
  97. <td>@reportMeta.year</td>
  98. </tr>
  99. }
  100. </table>
  101. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement