32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
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<WorkClientModel> GetFilteredList(WorkClientSearchModel model) {
|
|
using var context = new Database();
|
|
return context.WorksClients
|
|
.Where(x => x.ClientId == model.client_id)
|
|
.Select(x => x.GetViewModel)
|
|
.ToList();
|
|
}
|
|
}
|
|
} |