57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
|
using ServiceStationContracts.BindingModels;
|
|||
|
using ServiceStationContracts.ViewModels;
|
|||
|
using ServiceStationDataModels;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel.DataAnnotations;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace ServiceStationsDataBaseImplement.Models
|
|||
|
{
|
|||
|
public class ClientWork : IClientWorkModel
|
|||
|
{
|
|||
|
[Required]
|
|||
|
public int ClientId { get; set; }
|
|||
|
[Required]
|
|||
|
public int WorkId { get; set; }
|
|||
|
public static ClientWork? Create(ClientWorkBindingModel? model)
|
|||
|
{
|
|||
|
if (model == null)
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
return new ClientWork()
|
|||
|
{
|
|||
|
ClientId = model.ClientId,
|
|||
|
WorkId = model.WorkId
|
|||
|
};
|
|||
|
}
|
|||
|
public static ClientWork? Create(ClientWorkViewModel model)
|
|||
|
{
|
|||
|
return new ClientWork
|
|||
|
{
|
|||
|
ClientId = model.ClientId,
|
|||
|
WorkId = model.WorkId
|
|||
|
};
|
|||
|
}
|
|||
|
public void Update(ClientWorkBindingModel model)
|
|||
|
{
|
|||
|
if (model == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
ClientId = model.ClientId;
|
|||
|
WorkId = model.WorkId;
|
|||
|
|
|||
|
}
|
|||
|
public ClientWorkViewModel GetViewModel => new()
|
|||
|
{
|
|||
|
ClientId = ClientId,
|
|||
|
WorkId = WorkId
|
|||
|
};
|
|||
|
}
|
|||
|
}
|