Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async Task<ActionResult> GetRMschools()
- {
- Account account = new Account("chr_coko.pto@mail.ru", "***");
- var api = new MailRuCloud();
- api.Account = account;
- string schoolID = User.Identity.Name;
- var items = await api.GetItems($@"/Reports/{schoolID}");
- school school_current = schoolRepository.GetT(schoolID);
- List<RMschool> model = new List<RMschool>();
- foreach (var file_name in items.Files) //e.g. file_name = "0001_201636.zip"
- {
- int report_code = Convert.ToInt32(file_name.Name.Substring(5, 6)); //e.g. report_code = 201636
- var ob = monit95Context.ReportMetas.Find(report_code);
- model.Add(new RMschool
- {
- code = ob.code,
- name = ob.name,
- ProjectName = ob.ProjectName,
- year = ob.year,
- WWWref = $@"{school_current.ReportLink}/{file_name.Name}"
- });
- }
- return PartialView("_GetRMschools", model);
- @using Monit95App.Models
- @model List<RMschool>
- <body>
- <table class="table">
- <thead class="thead-inverse">
- <tr>
- <th>Проект</th>
- <th>Отчет</th>
- <th>Учебный год</th>
- </tr>
- </thead>
- @foreach (var reportMeta in Model.OrderByDescending(x => x.code))
- {
- <tr>
- <td>@reportMeta.ProjectName</td>
- <td><a href="@reportMeta.WWWref">@reportMeta.name</a></td>
- <td>@reportMeta.year</td>
- </tr>
- }
- </table>
- </body>
- <h2>Отчеты</h2>
- @Html.Action("GetRMschools")
- [HttpGet]
- public async Task<ActionResult> Report()
- {
- var model = await GetRMschoolList(User.Identity.Name);
- return PartialView("_RMschool", model);
- }
- public async Task<ActionResult> GetRMschoolPV(string _schoolID)
- {
- var model = await this.GetRMschoolList(_schoolID);
- return PartialView("_RMschool", model);
- }
- public async Task<List<RMschool>> GetRMschoolList(string _schoolID) //GetViewModel
- {
- Account account = new Account("chr_coko.pto@mail.ru", "***");
- var api = new MailRuCloud();
- api.Account = account;
- var items = await api.GetItems($@"/Reports/{_schoolID}");
- school school_current = schoolRepository.GetT(_schoolID);
- List<RMschool> model = new List<RMschool>();
- //du stuff
- return (model);
- }
- @model IEnumerable<Monit95App.Models.RMschool>
- @{ Html.RenderPartial("_RMschool", Model);}
- @model IEnumerable<Monit95App.Models.RMschool>
- <body>
- <table class="table">
- <thead class="thead-inverse">
- <tr>
- <th>Проект</th>
- <th>Отчет</th>
- <th>Учебный год</th>
- </tr>
- </thead>
- @foreach (var reportMeta in Model.OrderByDescending(x => x.code))
- {
- <tr>
- <td>@reportMeta.ProjectName</td>
- <td><a href="@reportMeta.WWWref">@reportMeta.name</a></td>
- <td>@reportMeta.year</td>
- </tr>
- }
- </table>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement