2024-08-26 19:12:46 +04:00

40 lines
884 B
C#

using ServiceStationContracts.HelperModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsDataBaseImplement.Models
{
public class WorkClient {
public int Id { get; set; }
[Required]
public int WorkId { get; set; }
[Required]
public int ClientId { get; set; }
public int PointCount { get; set; }
public virtual Work _work { get; set; } = new();
public virtual Client _client { get; set; } = new();
public bool Update(WorkClientModel? model) {
if (model == null) {
return false;
}
PointCount += model.Point_count;
return true;
}
public WorkClientModel GetViewModel => new() {
Client_Id = ClientId,
Work_Id = WorkId,
Point_count = PointCount,
};
}
}