Mapper NETMAUI-ba
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,12 +11,13 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
using WorkFlowCheck.MAUI.DataLayer;
|
||||
using WorkFlowCheck.MAUI.DataLayer.Entities;
|
||||
|
||||
namespace WorkFlowCheck.MAUI.Services
|
||||
{
|
||||
public class SyncService : BaseService, ISyncService
|
||||
{
|
||||
public SyncService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext) : base(httpClient, configuration, dbContext)
|
||||
public SyncService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper) : base(httpClient, configuration, dbContext, mapper)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -39,14 +41,12 @@ namespace WorkFlowCheck.MAUI.Services
|
||||
var checkPointList = await _dbContext.CheckPoints.ToListAsync();
|
||||
var missingItems = response.Data.CheckPointList.Where(f => !checkPointList.Any(s => s.Id == f.Id)).ToList();
|
||||
|
||||
foreach (var item in missingItems) {
|
||||
|
||||
}
|
||||
var missingCheckPoint = _mapper.Map<List<CheckPoint>>(missingItems);
|
||||
|
||||
_dbContext.CheckPoints.AddRange(missingCheckPoint);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user