Частичная готовность формы ведомостей

This commit is contained in:
GokaPek 2024-05-27 10:21:44 +04:00
parent 9453fd225a
commit 75ead823e8
4 changed files with 24 additions and 6 deletions

View File

@ -80,14 +80,32 @@ namespace UniversityClientApp.Controllers
return View(); return View();
} }
[HttpGet]
public IActionResult Statements() public IActionResult Statements()
{ {
if (APIStorekeeper.Client == null) if (APIStorekeeper.Client == null)
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
ViewBag.Teachers = APIStorekeeper.GetRequest<List<TeacherViewModel>>($"api/teacher/getteachers?userId={APIStorekeeper.Client.Id}");
return View(APIStorekeeper.GetRequest<List<StatementViewModel>>($"api/statement/getstatements?teacherId={0}")); return View(APIStorekeeper.GetRequest<List<StatementViewModel>>($"api/statement/getstatements?teacherId={0}"));
} }
[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");
}
[HttpGet] [HttpGet]
public IActionResult Teachers() public IActionResult Teachers()
@ -113,7 +131,7 @@ namespace UniversityClientApp.Controllers
Position = position, Position = position,
AcademicDegree = academicDegree AcademicDegree = academicDegree
}); });
Response.Redirect("Index"); Response.Redirect("Teachers");
} }
public IActionResult Report() { public IActionResult Report() {

View File

@ -14,19 +14,19 @@
<div class="row"> <div class="row">
<div class="col-4">Title:</div> <div class="col-4">Title:</div>
<div class="col-8"> <div class="col-8">
<input type="text" name="title" id="title" class="form-control" /> <input type="text" name="name" id="name" class="form-control" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-4">Date:</div> <div class="col-4">Date:</div>
<div class="col-8"> <div class="col-8">
<input type="date" name="date" id="date" class="form-control" /> <input type="datetime-local" name="date" id="date" class="form-control" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-4">Teacher:</div> <div class="col-4">Teacher:</div>
<div class="col-8"> <div class="col-8">
<select id="teacherId" name="teacherId" class="form-control" asp-items="ViewBag.Teachers"></select> <select id="teacher" name="teacher" class="form-control" asp-items="@(new SelectList(@ViewBag.Teachers,"Id", "Name"))"></select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -14,6 +14,6 @@ namespace UniversityContracts.BindingModels
public int UserId { get; set; } public int UserId { get; set; }
public int TeacherId { get; set; } public int TeacherId { get; set; }
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public DateTime Date { get; } public DateTime Date { get; set; }
} }
} }

View File

@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
//Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR //Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR
optionsBuilder.UseSqlServer(@"Data Source=DyCTaTOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-N8BRIPR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
} }