2024-04-23 15:58:02 +04:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.Diagnostics;
|
2024-05-26 23:51:13 +04:00
|
|
|
|
using System.Reflection.Metadata;
|
2024-04-23 15:58:02 +04:00
|
|
|
|
using UniversityClientApp.Models;
|
2024-05-26 16:22:04 +04:00
|
|
|
|
using UniversityClientAppStorekeeper;
|
|
|
|
|
using UniversityContracts.BindingModels;
|
|
|
|
|
using UniversityContracts.ViewModels;
|
2024-05-28 17:05:02 +04:00
|
|
|
|
using UniversityDatabaseImplement.Models;
|
|
|
|
|
using UniversityDatabaseImplement;
|
2024-05-26 16:22:04 +04:00
|
|
|
|
using UniversityDataModels.Enums;
|
2024-05-28 17:05:02 +04:00
|
|
|
|
using UniversityDataModels.Models;
|
2024-04-23 15:58:02 +04:00
|
|
|
|
|
|
|
|
|
namespace UniversityClientApp.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger<HomeController> _logger;
|
|
|
|
|
|
|
|
|
|
public HomeController(ILogger<HomeController> logger)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult Index()
|
|
|
|
|
{
|
2024-05-26 22:28:34 +04:00
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2024-04-23 15:58:02 +04:00
|
|
|
|
|
|
|
|
|
public IActionResult Privacy()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-26 16:22:04 +04:00
|
|
|
|
[HttpGet]
|
2024-04-28 16:30:27 +04:00
|
|
|
|
public IActionResult Enter()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2024-05-26 16:22:04 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Enter(string login, string password)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIStorekeeper.Client = APIStorekeeper.GetRequest<UserViewModel>($"api/user/loginstorekeeper?login={login}&password={password}");
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
Response.Redirect("Index");
|
|
|
|
|
}
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Register()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Register(string login, string password, string email)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIStorekeeper.PostRequest("api/user/registerstorekeeper", new UserBindingModel
|
|
|
|
|
{
|
|
|
|
|
Login = login,
|
|
|
|
|
Email = email,
|
|
|
|
|
Password = password,
|
|
|
|
|
Role = UserRole.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Enter");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-28 16:30:27 +04:00
|
|
|
|
|
2024-05-27 23:53:45 +04:00
|
|
|
|
[HttpGet]
|
2024-05-28 19:17:05 +04:00
|
|
|
|
public async Task<IActionResult> Disciplines()
|
2024-04-28 16:30:27 +04:00
|
|
|
|
{
|
2024-05-27 23:53:45 +04:00
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2024-05-28 19:17:05 +04:00
|
|
|
|
|
2024-05-27 23:53:45 +04:00
|
|
|
|
ViewBag.Teachers = APIStorekeeper.GetRequest<List<TeacherViewModel>>($"api/teacher/getteachers?userId={APIStorekeeper.Client.Id}");
|
2024-05-28 17:05:02 +04:00
|
|
|
|
ViewBag.Students = APIStorekeeper.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIStorekeeper.Client.Id}");
|
2024-05-28 19:17:05 +04:00
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-05-30 01:50:55 +04:00
|
|
|
|
var disciplines = await APIStorekeeper.GetRequestDisciplineAsync<List<DisciplineViewModel>>($"api/discipline/getdisciplines");
|
2024-05-28 19:17:05 +04:00
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
return View(disciplines);
|
2024-05-27 23:53:45 +04:00
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
2024-05-28 17:05:02 +04:00
|
|
|
|
public void Disciplines(string name, string description, DateOnly date, int teacher, List<int> studentIds)
|
2024-05-27 23:53:45 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2024-05-28 17:05:02 +04:00
|
|
|
|
|
|
|
|
|
var disciplineModel = new DisciplineBindingModel
|
2024-05-27 23:53:45 +04:00
|
|
|
|
{
|
|
|
|
|
UserId = APIStorekeeper.Client.Id,
|
|
|
|
|
Name = name,
|
|
|
|
|
Description = description,
|
|
|
|
|
Date = date,
|
|
|
|
|
TeacherId = teacher,
|
2024-05-28 17:05:02 +04:00
|
|
|
|
StudentDisciplines = studentIds.ToDictionary(id => id, id => (IStudentModel)null)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
APIStorekeeper.PostRequest("api/discipline/creatediscipline", disciplineModel);
|
|
|
|
|
|
2024-05-27 23:53:45 +04:00
|
|
|
|
Response.Redirect("Disciplines");
|
2024-04-28 16:30:27 +04:00
|
|
|
|
}
|
2024-05-28 17:05:02 +04:00
|
|
|
|
|
|
|
|
|
|
2024-04-28 16:30:27 +04:00
|
|
|
|
|
2024-05-27 10:21:44 +04:00
|
|
|
|
[HttpGet]
|
2024-04-28 16:30:27 +04:00
|
|
|
|
public IActionResult Statements()
|
|
|
|
|
{
|
2024-05-26 23:51:13 +04:00
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2024-05-27 10:21:44 +04:00
|
|
|
|
ViewBag.Teachers = APIStorekeeper.GetRequest<List<TeacherViewModel>>($"api/teacher/getteachers?userId={APIStorekeeper.Client.Id}");
|
2024-05-26 23:51:13 +04:00
|
|
|
|
return View(APIStorekeeper.GetRequest<List<StatementViewModel>>($"api/statement/getstatements?teacherId={0}"));
|
2024-04-28 16:30:27 +04:00
|
|
|
|
}
|
2024-05-27 10:21:44 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Statements(string name, DateTime date, int teacher)
|
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
APIStorekeeper.PostRequest("api/statement/createstatement", new StatementBindingModel
|
|
|
|
|
{
|
|
|
|
|
UserId = APIStorekeeper.Client.Id,
|
|
|
|
|
Name = name,
|
|
|
|
|
Date = date,
|
|
|
|
|
TeacherId = teacher,
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Statements");
|
|
|
|
|
}
|
2024-04-28 16:30:27 +04:00
|
|
|
|
|
2024-05-26 23:51:13 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Teachers()
|
2024-04-28 16:30:27 +04:00
|
|
|
|
{
|
2024-05-26 23:51:13 +04:00
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View(APIStorekeeper.GetRequest<List<TeacherViewModel>>($"api/teacher/getteachers?userId={APIStorekeeper.Client.Id}"));
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Teachers(string name, string position, string academicDegree)
|
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
APIStorekeeper.PostRequest("api/teacher/createteacher", new TeacherBindingModel
|
|
|
|
|
{
|
|
|
|
|
UserId = APIStorekeeper.Client.Id,
|
|
|
|
|
Name = name,
|
|
|
|
|
Position = position,
|
|
|
|
|
AcademicDegree = academicDegree
|
|
|
|
|
});
|
2024-05-27 10:21:44 +04:00
|
|
|
|
Response.Redirect("Teachers");
|
2024-05-26 23:51:13 +04:00
|
|
|
|
}
|
2024-05-29 11:30:39 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Report() {
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View("Report", APIStorekeeper.GetRequest<List<ReportTeacherViewModel>>($"api/teacher/getteachersreport?userId={APIStorekeeper.Client.Id}"));
|
|
|
|
|
}
|
2024-04-28 16:30:27 +04:00
|
|
|
|
|
2024-05-29 11:30:39 +04:00
|
|
|
|
[HttpPost]
|
2024-05-30 02:14:15 +04:00
|
|
|
|
public IActionResult Report(string type)
|
2024-05-29 11:30:39 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(type))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Error, wrong type");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == "docx")
|
|
|
|
|
{
|
|
|
|
|
APIStorekeeper.PostRequest("api/teacher/loadreporttoword", new ReportBindingModel
|
|
|
|
|
{
|
2024-05-30 03:37:42 +04:00
|
|
|
|
FileName = $"C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\TeachersAndStudents.docx"
|
|
|
|
|
});
|
2024-05-30 02:14:15 +04:00
|
|
|
|
return GetWordFile();
|
|
|
|
|
}
|
2024-05-29 11:30:39 +04:00
|
|
|
|
|
|
|
|
|
if (type == "xlsx")
|
|
|
|
|
{
|
|
|
|
|
APIStorekeeper.PostRequest("api/teacher/loadreporttoexcel", new ReportBindingModel
|
|
|
|
|
{
|
2024-05-30 03:37:42 +04:00
|
|
|
|
FileName = $"C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\TeachersAndStudents.xlsx"
|
2024-05-30 02:14:15 +04:00
|
|
|
|
});
|
|
|
|
|
return GetExcelFile();
|
|
|
|
|
}
|
|
|
|
|
return Redirect("Report");
|
|
|
|
|
}
|
2024-04-28 16:30:27 +04:00
|
|
|
|
|
2024-05-30 00:31:58 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void ReportDisciplines(string type, DateOnly dateFrom, DateOnly dateTo)
|
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
Redirect("~/Home/Enter");
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
2024-05-30 01:19:26 +04:00
|
|
|
|
if (dateFrom == DateOnly.MinValue || dateTo == DateOnly.MaxValue)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception();
|
|
|
|
|
}
|
2024-05-30 00:31:58 +04:00
|
|
|
|
if (type == "pdf")
|
|
|
|
|
{
|
2024-05-30 01:19:26 +04:00
|
|
|
|
APIStorekeeper.PostRequest($"api/discipline/createreporttopdffile?dateFrom={dateFrom:yyyy-MM-dd}&dateTo={dateTo:yyyy-MM-dd}", new ReportDateRangeBindingModel
|
2024-05-30 00:31:58 +04:00
|
|
|
|
{
|
2024-05-30 01:19:26 +04:00
|
|
|
|
FileName = "C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.pdf"
|
2024-05-30 00:31:58 +04:00
|
|
|
|
});
|
|
|
|
|
APIStorekeeper.PostRequest("api/discipline/sendpdftomail", new MailSendInfoBindingModel
|
|
|
|
|
{
|
|
|
|
|
MailAddress = APIStorekeeper.Client.Email,
|
|
|
|
|
Subject = "<22><><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
Text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
Response.Redirect("Index");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-05-29 23:23:53 +04:00
|
|
|
|
|
|
|
|
|
[HttpGet]
|
2024-05-30 00:09:06 +04:00
|
|
|
|
public IActionResult ReportDisciplines(DateOnly dateFrom, DateOnly dateTo)
|
2024-05-29 23:23:53 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-05-30 00:09:06 +04:00
|
|
|
|
if (dateFrom == DateOnly.MinValue || dateTo == DateOnly.MaxValue)
|
|
|
|
|
{
|
|
|
|
|
return View("ReportDisciplines", null);
|
|
|
|
|
}
|
|
|
|
|
var reportData = APIStorekeeper.GetRequest<List<ReportDisciplineViewModel>>($"api/discipline/getreportdisciplines?datefrom={dateFrom:yyyy-MM-dd}&dateto={dateTo:yyyy-MM-dd}");
|
|
|
|
|
|
|
|
|
|
return View("ReportDisciplines", reportData);
|
2024-05-29 23:23:53 +04:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-30 02:14:15 +04:00
|
|
|
|
|
|
|
|
|
public IActionResult GetWordFile()
|
|
|
|
|
{
|
|
|
|
|
return PhysicalFile($"C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\TeachersAndStudents.xlsx",
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
|
|
|
"TeachersAndStudents.docx");
|
|
|
|
|
}
|
|
|
|
|
public IActionResult GetExcelFile()
|
|
|
|
|
{
|
|
|
|
|
return PhysicalFile($"C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\TeachersAndStudents.xlsx",
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
"TeachersAndStudents.xlsx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-05-30 03:23:27 +04:00
|
|
|
|
// UDS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteTeacher(int id)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 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("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(academicdegree) || string.IsNullOrEmpty(position))
|
|
|
|
|
{
|
2024-05-30 04:16:38 +04:00
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
2024-05-30 03:23:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIStorekeeper.PostRequest("api/teacher/updateteacher", new TeacherBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
Name = name,
|
|
|
|
|
AcademicDegree = academicdegree,
|
|
|
|
|
Position = position
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Teachers");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-05-30 04:16:38 +04:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteStatement(int id)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
APIStorekeeper.PostRequest("api/statement/deletestatement", new StatementBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Statements");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult InfoStatement(int id)
|
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Teachers = APIStorekeeper.GetRequest<List<TeacherViewModel>>($"api/teacher/getteachers?userId={APIStorekeeper.Client.Id}");
|
|
|
|
|
var obj = APIStorekeeper.GetRequest<StatementViewModel>($"api/statement/getstatement?userId={APIStorekeeper.Client.Id}&id={id}");
|
|
|
|
|
return View(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void UpdateStatement(int id, string name, DateTime date, int teacher)
|
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(name) || teacher == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIStorekeeper.PostRequest("api/statement/updatestatement", new StatementBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
Name = name,
|
|
|
|
|
Date = date,
|
|
|
|
|
TeacherId = teacher
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Statements");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
2024-05-30 05:03:29 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<IActionResult> InfoDiscipline(int id)
|
|
|
|
|
{
|
|
|
|
|
if (APIStorekeeper.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
var obj1 = APIStorekeeper.GetRequest<List<StudentViewModel>>($"api/student/getallstudents");
|
|
|
|
|
ViewBag.Students = obj1;
|
|
|
|
|
var obj2 = APIStorekeeper.GetRequest<List<TeacherViewModel>>($"api/teacher/getteachers?userId={APIStorekeeper.Client.Id}");
|
|
|
|
|
ViewBag.Teachers = obj2;
|
|
|
|
|
var obj = await APIStorekeeper.GetRequestDisciplineAsync<DisciplineViewModel>($"api/discipline/getdiscipline?id={id}&userId={APIStorekeeper.Client.Id}");
|
|
|
|
|
return View(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteDiscipline(int id)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
APIStorekeeper.PostRequest("api/discipline/deletediscipline", new DisciplineBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Disciplines");
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void UpdateDiscipline(int id, string name, string description, int teacher, List<int> studentIds, DateOnly date)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
var disciplineStudents = studentIds.ToDictionary(id => id, id => (IStudentModel)null);
|
|
|
|
|
APIStorekeeper.PostRequest("api/discipline/updatediscipline", new DisciplineBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
Name = name,
|
|
|
|
|
Description = description,
|
|
|
|
|
TeacherId = teacher,
|
|
|
|
|
StudentDisciplines = disciplineStudents,
|
|
|
|
|
Date = date
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Disciplines");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-05-30 03:23:27 +04:00
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
2024-04-23 15:58:02 +04:00
|
|
|
|
public IActionResult Error()
|
|
|
|
|
{
|
|
|
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|