40 lines
884 B
C#
Raw Normal View History

2024-08-26 19:12:46 +04:00
using ServiceStationContracts.HelperModels;
2024-08-20 10:37:39 +04:00
using System;
2024-08-10 18:43:15 +04:00
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2024-08-26 19:12:46 +04:00
namespace ServiceStationsDataBaseImplement.Models
{
public class WorkClient {
2024-08-10 18:43:15 +04:00
public int Id { get; set; }
[Required]
public int WorkId { get; set; }
[Required]
public int ClientId { get; set; }
2024-08-20 10:37:39 +04:00
public int PointCount { get; set; }
2024-08-10 18:43:15 +04:00
public virtual Work _work { get; set; } = new();
public virtual Client _client { get; set; } = new();
2024-08-20 10:37:39 +04:00
2024-08-26 19:12:46 +04:00
public bool Update(WorkClientModel? model) {
2024-08-20 10:37:39 +04:00
if (model == null) {
return false;
}
PointCount += model.Point_count;
return true;
}
2024-08-26 19:12:46 +04:00
public WorkClientModel GetViewModel => new() {
Client_Id = ClientId,
Work_Id = WorkId,
Point_count = PointCount,
};
2024-08-20 10:37:39 +04:00
}
2024-08-10 18:43:15 +04:00
}