Круды препода финал
This commit is contained in:
parent
acbac6aadb
commit
ad24e2c38c
@ -27,7 +27,6 @@ namespace UniversityClientApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
//return View(APIStorekeeper.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -154,7 +153,6 @@ namespace UniversityClientApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
//ViewBag.Documents = APIStorekeeper.GetRequest<List<DisciplineViewModel>>("api/main/getdiscipline");
|
||||
return View(APIStorekeeper.GetRequest<List<TeacherViewModel>>($"api/teacher/getteachers?userId={APIStorekeeper.Client.Id}"));
|
||||
}
|
||||
[HttpPost]
|
||||
@ -252,10 +250,6 @@ namespace UniversityClientApp.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
|
||||
// Ïîëó÷àåì äàííûå îò ñåðâåðà
|
||||
//var reportData = APIStorekeeper.GetRequest<List<ReportDisciplineViewModel>>($"api/disciplines/GetReportDisciplines?datefrom={dateFrom}&dateto={dateTo}");
|
||||
|
||||
// Ïåðåäàåì äàííûå â ÷àñòè÷íîå ïðåäñòàâëåíèå
|
||||
if (dateFrom == DateOnly.MinValue || dateTo == DateOnly.MaxValue)
|
||||
{
|
||||
@ -281,7 +275,60 @@ namespace UniversityClientApp.Controllers
|
||||
}
|
||||
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
// UDS
|
||||
|
||||
|
||||
// Ïðåïîäàâàòåëü
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteTeacher(int id)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü ðàâåí 0");
|
||||
}
|
||||
APIStorekeeper.PostRequest("api/teacher/deleteteacher", new TeacherBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("Teachers");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult InfoTeacher(int id)
|
||||
{
|
||||
if (APIStorekeeper.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var obj = APIStorekeeper.GetRequest<TeacherViewModel>($"api/teacher/getteacher?userId={APIStorekeeper.Client.Id}&id={id}");
|
||||
return View(obj);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateTeacher(int id, string name, string academicdegree, string position)
|
||||
{
|
||||
if (APIStorekeeper.Client == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(academicdegree) || string.IsNullOrEmpty(position))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ôîðìó îöåíèâàíèÿ è âûáåðèòå ñòóäåíòà");
|
||||
}
|
||||
|
||||
APIStorekeeper.PostRequest("api/teacher/updateteacher", new TeacherBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
AcademicDegree = academicdegree,
|
||||
Position = position
|
||||
});
|
||||
Response.Redirect("Teachers");
|
||||
}
|
||||
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
|
44
University/UniversityClientApp/Views/Home/InfoTeacher.cshtml
Normal file
44
University/UniversityClientApp/Views/Home/InfoTeacher.cshtml
Normal file
@ -0,0 +1,44 @@
|
||||
@using UniversityContracts.ViewModels
|
||||
@model TeacherViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Преподаватель";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">@ViewData["Title"] - @Model.Id</h2>
|
||||
</div>
|
||||
<form asp-action="UpdateTeacher" method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Имя:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="name" id="name" class="form-control" value="@Model.Name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Учёная степень:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="academicDegree" id="academicDegree" class="form-control" value="@Model.AcademicDegree" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Должность:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="position" id="position" class="form-control" value="@Model.Position" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Create Teacher" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4 mt-2">
|
||||
<form asp-action="Teachers">
|
||||
<input type="submit" value="Отмена" class="btn btn-primary" />
|
||||
</form>
|
||||
<input type="hidden" name="id" value="@Model.Id" />
|
||||
<input type="submit" value="Сохранить" class="btn btn-danger" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -43,6 +43,7 @@
|
||||
<th>Имя</th>
|
||||
<th>Учёная степень</th>
|
||||
<th>Должность</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -61,6 +62,15 @@
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Position)
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a asp-controller="Home" asp-action="InfoTeacher" asp-route-id="@item.Id" class="btn btn-warning">Изменить</a>
|
||||
<form asp-controller="Home" asp-action="DeleteTeacher" method="post">
|
||||
<input type="hidden" name="id" value="@item.Id" />
|
||||
<button type="submit" class="btn btn-danger">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
@ -1,461 +1,461 @@
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PlumbingRepairClientApp;
|
||||
using System.Diagnostics;
|
||||
using UniversityClientAppWorker.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
using UniversityDataModels.Enums;
|
||||
using UniversityDataModels.Models;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace UniversityClientAppWorker.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Teachers = APIClient.GetRequest<List<TeacherViewModel>>($"api/teacher/getallteachers");
|
||||
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
||||
|
||||
return View(planOfStudys);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> InfoPlanOfStudy(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var obj1 = APIClient.GetRequest<List<TeacherViewModel>>($"api/teacher/getallteachers");
|
||||
ViewBag.Teachers = obj1;
|
||||
|
||||
var obj = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={id}&userId={APIClient.User.Id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreatePlanOfStudy(string profile, string formOfStudy, List<int> teacherIds)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì ïîëüçîâàòåëÿì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(formOfStudy) || string.IsNullOrEmpty(profile))
|
||||
{
|
||||
throw new Exception("Ââåäèòå äàííûå ïðîôèëÿ è ôîðìû îáó÷åíèÿ");
|
||||
}
|
||||
APIClient.PostRequest("api/planofstudys/createplanofstudy", new PlanOfStudyBindingModel
|
||||
{
|
||||
Profile = profile,
|
||||
FormOfStudy = formOfStudy,
|
||||
UserId = APIClient.User.Id,
|
||||
PlanOfStudyTeachers = teacherIds.ToDictionary(id => id, id => (ITeacherModel)null)
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeletePlanOfStudy(int id)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü ðàâåí 0");
|
||||
}
|
||||
APIClient.PostRequest("api/planofstudys/deleteplanofstudy", new PlanOfStudyBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdatePlanOfStudy(int id, string profile, string formOfStudy, List<int> teacherIds)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü ðàâåí 0");
|
||||
}
|
||||
var planOfStudyTeachers = teacherIds.ToDictionary(id => id, id => (ITeacherModel)null);
|
||||
APIClient.PostRequest("api/planofstudys/updateplanofstudy", new PlanOfStudyBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Profile = profile,
|
||||
FormOfStudy = formOfStudy,
|
||||
PlanOfStudyTeachers = planOfStudyTeachers
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.User);
|
||||
}
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string password, string email)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì ïîëüçîâàòåëÿì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ëîãèí, ïàðîëü è ïî÷òó");
|
||||
}
|
||||
APIClient.PostRequest("api/user/updatedata", new UserViewModel
|
||||
{
|
||||
Id = APIClient.User.Id,
|
||||
Email = email,
|
||||
Login = login,
|
||||
Password = password
|
||||
});
|
||||
|
||||
APIClient.User.Login = login;
|
||||
APIClient.User.Email = email;
|
||||
APIClient.User.Password = password;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Attestations()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}");
|
||||
ViewBag.AttestationScore = Enum.GetValues(typeof(AttestationScore)).Cast<AttestationScore>();
|
||||
var obj = APIClient.GetRequest<List<AttestationViewModel>>($"api/attestation/getattestations?userId={APIClient.User.Id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateAttestation(string formOfEvaluation, int student, AttestationScore score)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(formOfEvaluation) || student == 0)
|
||||
{
|
||||
throw new Exception("Ââåäèòå ôîðìó îöåíèâàíèÿ è âûáåðèòå ñòóäåíòà");
|
||||
}
|
||||
var Student = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={student}");
|
||||
|
||||
if(Student == null)
|
||||
{
|
||||
throw new Exception("Ñòóäåíò íå íàéäåí");
|
||||
}
|
||||
APIClient.PostRequest("api/attestation/createattestation", new AttestationBindingModel
|
||||
{
|
||||
UserId = APIClient.User.Id,
|
||||
FormOfEvaluation = formOfEvaluation,
|
||||
StudentId = student,
|
||||
StudentName = Student.Name,
|
||||
Score = score
|
||||
});
|
||||
Response.Redirect("Attestations");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult InfoAttestation(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}");
|
||||
ViewBag.AttestationScore = Enum.GetValues(typeof(AttestationScore)).Cast<AttestationScore>();
|
||||
var obj = APIClient.GetRequest<AttestationViewModel>($"api/attestation/getattestation?userId={APIClient.User.Id}&id={id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateAttestation(int id, string formOfEvaluation, int student, AttestationScore score)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(formOfEvaluation) || student == 0)
|
||||
{
|
||||
throw new Exception("Ââåäèòå ôîðìó îöåíèâàíèÿ è âûáåðèòå ñòóäåíòà");
|
||||
}
|
||||
var Student = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={student}");
|
||||
|
||||
if (Student == null)
|
||||
{
|
||||
throw new Exception("Ñòóäåíò íå íàéäåí");
|
||||
}
|
||||
APIClient.PostRequest("api/attestation/updateattestation", new AttestationBindingModel
|
||||
{
|
||||
Id = id,
|
||||
FormOfEvaluation = formOfEvaluation,
|
||||
StudentId = student,
|
||||
StudentName = Student.Name,
|
||||
Score = score
|
||||
});
|
||||
Response.Redirect("Attestations");
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeleteAttestation(int id)
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PlumbingRepairClientApp;
|
||||
using System.Diagnostics;
|
||||
using UniversityClientAppWorker.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
using UniversityDataModels.Enums;
|
||||
using UniversityDataModels.Models;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace UniversityClientAppWorker.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü ðàâåí 0");
|
||||
}
|
||||
APIClient.PostRequest("api/attestation/deleteattestation", new PlanOfStudyBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("Attestations");
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Students()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>
|
||||
($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
||||
ViewBag.PlanOfStudys = planOfStudys;
|
||||
return View(APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}"));
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> CreateStudent(string name, int planOfStudy, string phoneNumber)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(name) || planOfStudy == 0 || string.IsNullOrEmpty(phoneNumber))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ÔÈÎ, ïëàí îáó÷åíèÿ è òåëåôîí");
|
||||
}
|
||||
var PlanOfStudy = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={planOfStudy}");
|
||||
if(PlanOfStudy == null)
|
||||
{
|
||||
throw new Exception("Ïëàí îáó÷åíèÿ íå íàéäåí");
|
||||
}
|
||||
APIClient.PostRequest("api/student/createstudent", new StudentBindingModel
|
||||
{
|
||||
UserId = APIClient.User.Id,
|
||||
Name = name,
|
||||
PlanOfStudyId = planOfStudy,
|
||||
PlanOfStudyProfile = PlanOfStudy.Profile,
|
||||
PhoneNumber = phoneNumber,
|
||||
|
||||
});
|
||||
return Redirect("/Home/Students");
|
||||
}
|
||||
_logger = logger;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> InfoStudent(int id)
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
}
|
||||
ViewBag.Teachers = APIClient.GetRequest<List<TeacherViewModel>>($"api/teacher/getallteachers");
|
||||
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
||||
|
||||
return View(planOfStudys);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> InfoPlanOfStudy(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var obj1 = APIClient.GetRequest<List<TeacherViewModel>>($"api/teacher/getallteachers");
|
||||
ViewBag.Teachers = obj1;
|
||||
|
||||
var obj = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={id}&userId={APIClient.User.Id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreatePlanOfStudy(string profile, string formOfStudy, List<int> teacherIds)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì ïîëüçîâàòåëÿì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(formOfStudy) || string.IsNullOrEmpty(profile))
|
||||
{
|
||||
throw new Exception("Ââåäèòå äàííûå ïðîôèëÿ è ôîðìû îáó÷åíèÿ");
|
||||
}
|
||||
APIClient.PostRequest("api/planofstudys/createplanofstudy", new PlanOfStudyBindingModel
|
||||
{
|
||||
Profile = profile,
|
||||
FormOfStudy = formOfStudy,
|
||||
UserId = APIClient.User.Id,
|
||||
PlanOfStudyTeachers = teacherIds.ToDictionary(id => id, id => (ITeacherModel)null)
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeletePlanOfStudy(int id)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü ðàâåí 0");
|
||||
}
|
||||
APIClient.PostRequest("api/planofstudys/deleteplanofstudy", new PlanOfStudyBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdatePlanOfStudy(int id, string profile, string formOfStudy, List<int> teacherIds)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü ðàâåí 0");
|
||||
}
|
||||
var planOfStudyTeachers = teacherIds.ToDictionary(id => id, id => (ITeacherModel)null);
|
||||
APIClient.PostRequest("api/planofstudys/updateplanofstudy", new PlanOfStudyBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Profile = profile,
|
||||
FormOfStudy = formOfStudy,
|
||||
PlanOfStudyTeachers = planOfStudyTeachers
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.User);
|
||||
}
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string password, string email)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì ïîëüçîâàòåëÿì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ëîãèí, ïàðîëü è ïî÷òó");
|
||||
}
|
||||
APIClient.PostRequest("api/user/updatedata", new UserViewModel
|
||||
{
|
||||
Id = APIClient.User.Id,
|
||||
Email = email,
|
||||
Login = login,
|
||||
Password = password
|
||||
});
|
||||
|
||||
APIClient.User.Login = login;
|
||||
APIClient.User.Email = email;
|
||||
APIClient.User.Password = password;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Attestations()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}");
|
||||
ViewBag.AttestationScore = Enum.GetValues(typeof(AttestationScore)).Cast<AttestationScore>();
|
||||
var obj = APIClient.GetRequest<List<AttestationViewModel>>($"api/attestation/getattestations?userId={APIClient.User.Id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateAttestation(string formOfEvaluation, int student, AttestationScore score)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(formOfEvaluation) || student == 0)
|
||||
{
|
||||
throw new Exception("Ââåäèòå ôîðìó îöåíèâàíèÿ è âûáåðèòå ñòóäåíòà");
|
||||
}
|
||||
var Student = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={student}");
|
||||
|
||||
if(Student == null)
|
||||
{
|
||||
throw new Exception("Ñòóäåíò íå íàéäåí");
|
||||
}
|
||||
APIClient.PostRequest("api/attestation/createattestation", new AttestationBindingModel
|
||||
{
|
||||
UserId = APIClient.User.Id,
|
||||
FormOfEvaluation = formOfEvaluation,
|
||||
StudentId = student,
|
||||
StudentName = Student.Name,
|
||||
Score = score
|
||||
});
|
||||
Response.Redirect("Attestations");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult InfoAttestation(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}");
|
||||
ViewBag.AttestationScore = Enum.GetValues(typeof(AttestationScore)).Cast<AttestationScore>();
|
||||
var obj = APIClient.GetRequest<AttestationViewModel>($"api/attestation/getattestation?userId={APIClient.User.Id}&id={id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateAttestation(int id, string formOfEvaluation, int student, AttestationScore score)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(formOfEvaluation) || student == 0)
|
||||
{
|
||||
throw new Exception("Ââåäèòå ôîðìó îöåíèâàíèÿ è âûáåðèòå ñòóäåíòà");
|
||||
}
|
||||
var Student = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={student}");
|
||||
|
||||
if (Student == null)
|
||||
{
|
||||
throw new Exception("Ñòóäåíò íå íàéäåí");
|
||||
}
|
||||
APIClient.PostRequest("api/attestation/updateattestation", new AttestationBindingModel
|
||||
{
|
||||
Id = id,
|
||||
FormOfEvaluation = formOfEvaluation,
|
||||
StudentId = student,
|
||||
StudentName = Student.Name,
|
||||
Score = score
|
||||
});
|
||||
Response.Redirect("Attestations");
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeleteAttestation(int id)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü ðàâåí 0");
|
||||
}
|
||||
APIClient.PostRequest("api/attestation/deleteattestation", new PlanOfStudyBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("Attestations");
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Students()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>
|
||||
($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
||||
ViewBag.PlanOfStudys = planOfStudys;
|
||||
return View(APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}"));
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> CreateStudent(string name, int planOfStudy, string phoneNumber)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (string.IsNullOrEmpty(name) || planOfStudy == 0 || string.IsNullOrEmpty(phoneNumber))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ÔÈÎ, ïëàí îáó÷åíèÿ è òåëåôîí");
|
||||
}
|
||||
var PlanOfStudy = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={planOfStudy}");
|
||||
if(PlanOfStudy == null)
|
||||
{
|
||||
throw new Exception("Ïëàí îáó÷åíèÿ íå íàéäåí");
|
||||
}
|
||||
APIClient.PostRequest("api/student/createstudent", new StudentBindingModel
|
||||
{
|
||||
UserId = APIClient.User.Id,
|
||||
Name = name,
|
||||
PlanOfStudyId = planOfStudy,
|
||||
PlanOfStudyProfile = PlanOfStudy.Profile,
|
||||
PhoneNumber = phoneNumber,
|
||||
|
||||
});
|
||||
return Redirect("/Home/Students");
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> InfoStudent(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if(id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü 0");
|
||||
}
|
||||
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>
|
||||
($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
||||
ViewBag.PlanOfStudys = planOfStudys;
|
||||
var obj = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
}
|
||||
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>
|
||||
($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
||||
ViewBag.PlanOfStudys = planOfStudys;
|
||||
var obj = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={id}");
|
||||
return View(obj);
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> UpdateStudent(int id, string name, int planOfStudy, string phoneNumber)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if(id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü 0");
|
||||
}
|
||||
if (string.IsNullOrEmpty(name) || planOfStudy == 0 || string.IsNullOrEmpty(phoneNumber))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ÔÈÎ, ïëàí îáó÷åíèÿ è òåëåôîí");
|
||||
}
|
||||
var PlanOfStudy = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={planOfStudy}");
|
||||
if (string.IsNullOrEmpty(name) || planOfStudy == 0 || string.IsNullOrEmpty(phoneNumber))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ÔÈÎ, ïëàí îáó÷åíèÿ è òåëåôîí");
|
||||
}
|
||||
var PlanOfStudy = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={planOfStudy}");
|
||||
if (PlanOfStudy == null)
|
||||
{
|
||||
throw new Exception("Ïëàí îáó÷åíèÿ íå íàéäåí");
|
||||
}
|
||||
APIClient.PostRequest("api/student/updatestudent", new StudentBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
PlanOfStudyId = planOfStudy,
|
||||
PlanOfStudyProfile = PlanOfStudy.Profile,
|
||||
APIClient.PostRequest("api/student/updatestudent", new StudentBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
PlanOfStudyId = planOfStudy,
|
||||
PlanOfStudyProfile = PlanOfStudy.Profile,
|
||||
PhoneNumber = phoneNumber,
|
||||
});
|
||||
return Redirect("/Home/Students");
|
||||
}
|
||||
[HttpPost]
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeleteStudent(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (id == 0)
|
||||
{
|
||||
throw new Exception("id íå ìîæåò áûòü 0");
|
||||
}
|
||||
APIClient.PostRequest("api/student/deletestudent", new StudentBindingModel
|
||||
{
|
||||
APIClient.PostRequest("api/student/deletestudent", new StudentBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("Students");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ëîãèí è ïàðîëü");
|
||||
}
|
||||
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/user/loginworker?login={login}&password={password}");
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Íåâåðíûé ëîãèí/ïàðîëü");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public void Register(string login, string password, string email)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ëîãèí, ïàðîëü è ïî÷òó");
|
||||
}
|
||||
APIClient.PostRequest("api/user/registerworker", new UserBindingModel
|
||||
{
|
||||
Email = email,
|
||||
Login = login,
|
||||
Password = password
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
return PhysicalFile($"C:\\Users\\{Environment.UserName}\\Downloads\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.docx",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.docx");
|
||||
}
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
return PhysicalFile($"C:\\Users\\{Environment.UserName}\\Downloads\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.xlsx");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult ReportPlanOfStudys()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View("ReportPlanOfStudys", APIClient.GetRequest<List<ReportPlanOfStudyViewModel>>($"api/planofstudys/getplanofstudyanddisciplines?userId={APIClient.User.Id}"));
|
||||
}
|
||||
[HttpPost]
|
||||
public IActionResult ReportPlanOfStudys(string type)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
Redirect("~/Home/Enter");
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
throw new Exception("Íåâåðíûé òèï îò÷åòà");
|
||||
}
|
||||
|
||||
if (type == "docx")
|
||||
{
|
||||
APIClient.PostRequest("api/planofstudys/loadreporttoword", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\ÂðåìåííûåÎò÷¸òû\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.docx"
|
||||
});
|
||||
return GetWordFile();
|
||||
}
|
||||
|
||||
if (type == "xlsx")
|
||||
{
|
||||
APIClient.PostRequest("api/planofstudys/loadreporttoexcel", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\ÂðåìåííûåÎò÷¸òû\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.xlsx"
|
||||
});
|
||||
return GetExcelFile();
|
||||
}
|
||||
return Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult ReportPlanOfStudyAndStudents()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View("ReportPlanOfStudyAndStudents", APIClient.GetRequest<List<ReportPlanOfStudyAndStudentViewModel>>($"api/planofstudys/getplanofstudyandstudents"));
|
||||
}
|
||||
[HttpPost]
|
||||
public void ReportPlanOfStudyAndStudents(string type)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
Redirect("~/Home/Enter");
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (type == "pdf")
|
||||
{
|
||||
APIClient.PostRequest("api/planofstudys/createreporttopdffile", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\ÂðåìåííûåÎò÷¸òû\\Ñâåäåíèÿ ïî ïëàíàì îáó÷åíèÿ.pdf"
|
||||
});
|
||||
APIClient.PostRequest("api/planofstudys/sendpdftomail", new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = APIClient.User.Email,
|
||||
Subject = "Îò÷åò",
|
||||
Text = "Ñâåäåíèÿ ïî ïëàíàì îáó÷åíèÿ"
|
||||
});
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ëîãèí è ïàðîëü");
|
||||
}
|
||||
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/user/loginworker?login={login}&password={password}");
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Íåâåðíûé ëîãèí/ïàðîëü");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public void Register(string login, string password, string email)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Ââåäèòå ëîãèí, ïàðîëü è ïî÷òó");
|
||||
}
|
||||
APIClient.PostRequest("api/user/registerworker", new UserBindingModel
|
||||
{
|
||||
Email = email,
|
||||
Login = login,
|
||||
Password = password
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
return PhysicalFile($"C:\\Users\\{Environment.UserName}\\Downloads\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.docx",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.docx");
|
||||
}
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
return PhysicalFile($"C:\\Users\\{Environment.UserName}\\Downloads\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.xlsx");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult ReportPlanOfStudys()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View("ReportPlanOfStudys", APIClient.GetRequest<List<ReportPlanOfStudyViewModel>>($"api/planofstudys/getplanofstudyanddisciplines?userId={APIClient.User.Id}"));
|
||||
}
|
||||
[HttpPost]
|
||||
public IActionResult ReportPlanOfStudys(string type)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
Redirect("~/Home/Enter");
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
throw new Exception("Íåâåðíûé òèï îò÷åòà");
|
||||
}
|
||||
|
||||
if (type == "docx")
|
||||
{
|
||||
APIClient.PostRequest("api/planofstudys/loadreporttoword", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\ÂðåìåííûåÎò÷¸òû\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.docx"
|
||||
});
|
||||
return GetWordFile();
|
||||
}
|
||||
|
||||
if (type == "xlsx")
|
||||
{
|
||||
APIClient.PostRequest("api/planofstudys/loadreporttoexcel", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\ÂðåìåííûåÎò÷¸òû\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.xlsx"
|
||||
});
|
||||
return GetExcelFile();
|
||||
}
|
||||
return Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult ReportPlanOfStudyAndStudents()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View("ReportPlanOfStudyAndStudents", APIClient.GetRequest<List<ReportPlanOfStudyAndStudentViewModel>>($"api/planofstudys/getplanofstudyandstudents"));
|
||||
}
|
||||
[HttpPost]
|
||||
public void ReportPlanOfStudyAndStudents(string type)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
Redirect("~/Home/Enter");
|
||||
throw new Exception("Âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
if (type == "pdf")
|
||||
{
|
||||
APIClient.PostRequest("api/planofstudys/createreporttopdffile", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\ÂðåìåííûåÎò÷¸òû\\Ñâåäåíèÿ ïî ïëàíàì îáó÷åíèÿ.pdf"
|
||||
});
|
||||
APIClient.PostRequest("api/planofstudys/sendpdftomail", new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = APIClient.User.Email,
|
||||
Subject = "Îò÷åò",
|
||||
Text = "Ñâåäåíèÿ ïî ïëàíàì îáó÷åíèÿ"
|
||||
});
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ namespace UniversityDatabaseImplement.Models
|
||||
return;
|
||||
}
|
||||
Id = model.Id;
|
||||
UserId = model.UserId;
|
||||
Name = model.Name;
|
||||
AcademicDegree = model.AcademicDegree;
|
||||
Position = model.Position;
|
||||
|
@ -20,6 +20,21 @@ namespace UniversityRestApi.Controllers
|
||||
_logger = logger;
|
||||
_reportLogic = reportLogic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public TeacherViewModel? GetTeacher(int userId, int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new TeacherSearchModel { UserId = userId, Id = id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения teacher user {Id}", userId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<TeacherViewModel>? GetTeachers(int userId)
|
||||
{
|
||||
@ -59,7 +74,7 @@ namespace UniversityRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPut]
|
||||
[HttpPost]
|
||||
public void UpdateTeacher(TeacherBindingModel model)
|
||||
{
|
||||
try
|
||||
@ -72,7 +87,7 @@ namespace UniversityRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
public void DeleteTeacher(TeacherBindingModel model)
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user