Обновил схему БД, разрешил null на комментариях
This commit is contained in:
parent
5546ab58e7
commit
9f44ad75be
@ -5,10 +5,10 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
public class DiagnoseBindingModel : IDiagnoseModel
|
public class DiagnoseBindingModel : IDiagnoseModel
|
||||||
{
|
{
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; }
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public DateTime DateStartDiagnose { get; }
|
public DateTime DateStartDiagnose { get; set; }
|
||||||
public DateTime? DateStopDiagnose { get; }
|
public DateTime? DateStopDiagnose { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Дата 'от'")]
|
[DisplayName("Дата 'от'")]
|
||||||
public DateTime DateStartDiagnose { get; set; }
|
public DateTime DateStartDiagnose { get; set; }
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
public interface IDiagnoseModel : IId
|
public interface IDiagnoseModel : IId
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Comment { get; }
|
string? Comment { get; }
|
||||||
int UserId { get; }
|
int UserId { get; }
|
||||||
DateTime DateStartDiagnose { get; }
|
DateTime DateStartDiagnose { get; }
|
||||||
DateTime? DateStopDiagnose { get; }
|
DateTime? DateStopDiagnose { get; }
|
||||||
|
@ -19,7 +19,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
DaysCount = table.Column<int>(type: "int", nullable: false),
|
DaysCount = table.Column<int>(type: "int", nullable: false),
|
||||||
PillsPerDay = table.Column<int>(type: "int", nullable: false),
|
PillsPerDay = table.Column<int>(type: "int", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
ProceduresCount = table.Column<int>(type: "int", nullable: false),
|
ProceduresCount = table.Column<int>(type: "int", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
CourseId = table.Column<int>(type: "int", nullable: true)
|
CourseId = table.Column<int>(type: "int", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@ -83,7 +83,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
UserId = table.Column<int>(type: "int", nullable: false),
|
UserId = table.Column<int>(type: "int", nullable: false),
|
||||||
DateStartDiagnose = table.Column<DateTime>(type: "datetime2", nullable: false),
|
DateStartDiagnose = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
DateStopDiagnose = table.Column<DateTime>(type: "datetime2", nullable: true)
|
DateStopDiagnose = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||||
@ -109,7 +109,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
DateStartProcedure = table.Column<DateTime>(type: "datetime2", nullable: false),
|
DateStartProcedure = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
DateStopProcedure = table.Column<DateTime>(type: "datetime2", nullable: true),
|
DateStopProcedure = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -207,7 +207,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
ProcedureId = table.Column<int>(type: "int", nullable: false),
|
ProcedureId = table.Column<int>(type: "int", nullable: false),
|
||||||
SymptomId = table.Column<int>(type: "int", nullable: false)
|
SymptomId = table.Column<int>(type: "int", nullable: false)
|
||||||
},
|
},
|
||||||
|
@ -9,8 +9,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[Required]
|
public string? Comment { get; set; }
|
||||||
public string Comment { get; set; } = string.Empty;
|
|
||||||
[Required]
|
[Required]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
|
@ -21,7 +21,6 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public DateTime? DateStopProcedure { get; set; }
|
public DateTime? DateStopProcedure { get; set; }
|
||||||
public virtual User User { get; set; } = new();
|
public virtual User User { get; set; } = new();
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
public static Procedure Create(ProcedureBindingModel bindingModel)
|
public static Procedure Create(ProcedureBindingModel bindingModel)
|
||||||
|
@ -14,7 +14,6 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int ProceduresCount { get; set; }
|
public int ProceduresCount { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
public int? CourseId { get; set; }
|
public int? CourseId { get; set; }
|
||||||
public virtual Course Course { get; set; } = new();
|
public virtual Course Course { get; set; } = new();
|
||||||
|
@ -11,7 +11,6 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[Required]
|
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
[ForeignKey("SymptomId")]
|
[ForeignKey("SymptomId")]
|
||||||
public virtual List<SymptomDiagnose> Diagnoses { get; set; } = new();
|
public virtual List<SymptomDiagnose> Diagnoses { get; set; } = new();
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
using PolyclinicContracts.BusinessLogicsContracts;
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
|
using PolyclinicContracts.SearchModels;
|
||||||
using PolyclinicContracts.ViewModels;
|
using PolyclinicContracts.ViewModels;
|
||||||
using PolyclinicWebAppImplementer.Models;
|
using PolyclinicWebAppImplementer.Models;
|
||||||
|
|
||||||
@ -19,20 +21,59 @@ namespace PolyclinicWebAppImplementer.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
|
// TODO выводить только пользовательские диагнозы
|
||||||
List<DiagnoseViewModel> diagnoses = _diagnoseLogic.ReadList();
|
List<DiagnoseViewModel> diagnoses = _diagnoseLogic.ReadList();
|
||||||
return View(diagnoses);
|
return View("DiagnosesList", diagnoses);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult CreateDiagnose()
|
[HttpPost]
|
||||||
|
public IActionResult Add(int id, string name, string comment, DateTime dateStart, DateTime dateStop)
|
||||||
{
|
{
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
ViewData["Title"] = "Новый диагноз";
|
||||||
|
return View("DiagnoseForm");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO прописать UserId
|
||||||
|
DiagnoseBindingModel diagnose = new DiagnoseBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Name = name,
|
||||||
|
Comment = comment,
|
||||||
|
DateStartDiagnose = dateStart,
|
||||||
|
DateStopDiagnose = dateStop,
|
||||||
|
};
|
||||||
|
_diagnoseLogic.Create(diagnose);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult EditDiagnose()
|
[HttpPost]
|
||||||
|
public IActionResult Edit(int id, string name, string comment, DateTime dateStart, DateTime dateStop)
|
||||||
{
|
{
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
var obj = _diagnoseLogic.ReadElement(new DiagnoseSearchModel { Id = id });
|
||||||
|
ViewData["Title"] = "Редактировать диагноз";
|
||||||
|
return View("DiagnoseForm", obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DiagnoseBindingModel diagnose = new DiagnoseBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Name = name,
|
||||||
|
Comment = comment,
|
||||||
|
DateStartDiagnose = dateStart,
|
||||||
|
DateStopDiagnose = dateStop,
|
||||||
|
};
|
||||||
|
_diagnoseLogic.Update(diagnose);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
@using PolyclinicContracts.ViewModels
|
||||||
|
@model DiagnoseViewModel
|
||||||
|
<h4>@ViewData["Title"]</h4>
|
||||||
|
<form class="d-flex flex-column" method="post">
|
||||||
|
<input type="hidden" name="id" readonly value="@Model?.Id" />
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-3">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" id="name" name="name" value="@Model?.Name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-3">Коментарий:</div>
|
||||||
|
<div class="col-8"><textarea id="comment" name="comment">@Model?.Comment</textarea></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-3">Начало:</div>
|
||||||
|
<div class="col-8"><input type="date" id="dateStartInput" name="dateStart" value="@Model?.DateStartDiagnose" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-3">Конец:</div>
|
||||||
|
<div class="col-8"><input type="date" id="dateStopInput" name="dateStop" value="@Model?.DateStopDiagnose" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">
|
||||||
|
<button class="btn btn-success" type="submit">
|
||||||
|
Сохранить
|
||||||
|
</button>
|
||||||
|
@Html.ActionLink("Отмена", "", "Diagnoses", null, new { @class = "btn btn-danger" })
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Views.Diagnoses
|
||||||
|
{
|
||||||
|
public class DiagnoseFormModel : PageModel
|
||||||
|
{
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user