2023-10-21 00:15:53 +04:00
|
|
|
|
using Contracts.BindingModel;
|
|
|
|
|
using Contracts.ViewModel;
|
|
|
|
|
using DataModels.Models;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DatabaseImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class LabWork : ILabWork
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
2023-10-23 16:21:36 +04:00
|
|
|
|
[Required]
|
2023-10-21 00:15:53 +04:00
|
|
|
|
public string Theme { get; set; } = string.Empty;
|
|
|
|
|
|
2023-10-23 16:21:36 +04:00
|
|
|
|
[Required]
|
|
|
|
|
public string FCs { get; set; }
|
2023-10-21 00:15:53 +04:00
|
|
|
|
|
2023-10-23 16:21:36 +04:00
|
|
|
|
[Required]
|
|
|
|
|
public string Discipline { get; set; }
|
2023-10-21 00:15:53 +04:00
|
|
|
|
|
2023-10-23 16:21:36 +04:00
|
|
|
|
[Required]
|
2023-10-21 00:15:53 +04:00
|
|
|
|
public string[] Questions { get; set; }
|
|
|
|
|
|
|
|
|
|
public static LabWork? Create(LabWorkBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new LabWork()
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
Theme = model.Theme,
|
|
|
|
|
FCs = model.FCs,
|
2023-10-23 16:21:36 +04:00
|
|
|
|
Discipline = model.Discipline,
|
2023-10-21 00:15:53 +04:00
|
|
|
|
Questions = model.Questions
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Update(LabWorkBindingModel? model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Id = model.Id;
|
|
|
|
|
Theme = model.Theme;
|
|
|
|
|
FCs = model.FCs;
|
2023-10-23 16:21:36 +04:00
|
|
|
|
Discipline = model.Discipline;
|
2023-10-21 00:15:53 +04:00
|
|
|
|
Questions = model.Questions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LabWorkViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
Theme = Theme,
|
|
|
|
|
FCs = FCs,
|
2023-10-23 16:21:36 +04:00
|
|
|
|
Discipline = Discipline,
|
2023-10-21 00:15:53 +04:00
|
|
|
|
Questions = Questions
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|