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 Lessons { get; set; } = new(); public static SchedulePlace Create(SchedulePlaceBindingModel model) { 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 }; } }