2024-04-08 14:40:49 +04:00
|
|
|
|
using SchoolScheduleContracts.BindingModels;
|
|
|
|
|
using SchoolScheduleContracts.ViewModels;
|
|
|
|
|
using SchoolScheduleDataModels.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace SchoolScheduleDataBaseImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class SchedulePlace : ISchedulePlaceModel
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; private set; }
|
|
|
|
|
[Required]
|
|
|
|
|
public TimeOnly Time { get; private set; }
|
|
|
|
|
[ForeignKey("SchedulePlaceId")]
|
|
|
|
|
public virtual List<Lesson> Lessons { get; set; } = new();
|
2024-04-08 22:02:19 +04:00
|
|
|
|
public static SchedulePlace Create(SchedulePlaceBindingModel model)
|
2024-04-08 14:40:49 +04:00
|
|
|
|
{
|
|
|
|
|
return new SchedulePlace
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
Time = model.Time,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
public void Update(SchedulePlaceBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
Time = model.Time;
|
|
|
|
|
}
|
|
|
|
|
public SchedulePlaceViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
Time = Time
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|