using ServiceStationContracts.HelperModels; using ServiceStationContracts.SearchModels; using ServiceStationContracts.StorageContracts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ServiceStationsDataBaseImplement.Implements { public class WorkClientStorage : IWorkClientStorage { public bool Add_Points(WorkClientModel model) { using var context = new Database(); var rec = context.WorksClients.FirstOrDefault(x => x.WorkId == model.Work_Id && x.ClientId == model.Client_Id); if (rec == null) { return false; } var ans = rec.Update(model); context.SaveChanges(); return ans; } public List GetFilteredList(WorkClientSearchModel model) { using var context = new Database(); return context.WorksClients .Where(x => x.ClientId == model.client_id) .Select(x => x.GetViewModel) .ToList(); } } }