LabSubd/Subd/DataBase/Place.cs

52 lines
1.1 KiB
C#

using Contracts.BindingModels;
using Contracts.ViewModels;
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Xml.Linq;
namespace DataBase;
/// <summary>
/// Таблица мест
/// </summary>
public partial class Place : IPlace
{
/// <summary>
/// Айди места
/// </summary>
public int Id { get; set; }
/// <summary>
/// Наименование места
/// </summary>
public string Title { get; set; } = null!;
public virtual ICollection<Route> RoutePlaceEndNavigations { get; set; } = new List<Route>();
public virtual ICollection<Route> RoutePlaceStartNavigations { get; set; } = new List<Route>();
public static Place Create(LogisticContext context, PlaceBM model)
{
return new Place()
{
Id = model.Id,
Title = model.Title,
};
}
public void Update(PlaceBM model)
{
Title = model.Title;
}
public PlaceVM GetViewModel => new()
{
Id = Id,
Title = Title,
};
}