72 lines
1.7 KiB
C#
Raw Normal View History

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; }
[Required]
2023-10-21 00:15:53 +04:00
public string Theme { get; set; } = string.Empty;
[Required]
public string FCs { get; set; }
2023-10-21 00:15:53 +04:00
[Required]
public string Discipline { get; set; }
2023-10-21 00:15:53 +04:00
[Required]
2023-10-23 16:47:58 +04:00
public string Questions { get; set; }
2023-10-21 00:15:53 +04:00
public static LabWork? Create(LabWorkBindingModel model)
{
if (model == null)
{
return null;
}
return new LabWork()
{
Id = model.Id,
Theme = model.Theme,
FCs = model.FCs,
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;
Discipline = model.Discipline;
2023-10-21 00:15:53 +04:00
Questions = model.Questions;
}
public LabWorkViewModel GetViewModel => new()
{
Id = Id,
Theme = Theme,
FCs = FCs,
Discipline = Discipline,
2023-10-21 00:15:53 +04:00
Questions = Questions
};
}
}