public Task <int> SaveCustDetailsAsync(CustDetails custDetails) { return(_database.InsertAsync(custDetails)); }
public IEnumerable <MappingGridModel> GetIngestionGridDetails() { List <MappingGridModel> lstMasterTableDetails = new List <MappingGridModel>(); try { using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString)) { lstMasterTableDetails = (from map in _dbContext.LandingToCoreMapDetails join L in _dbContext.LandingTableDetails on map.LandingDetailId equals L.LandingDetailId join ds in _dbContext.DatasetMaster on map.DatasetId equals ds.DatasetId join inf in _dbContext.InterfaceMaster on ds.InterfaceId equals inf.InterfaceId join p in _dbContext.PartyAcctDetails on inf.PartyId equals p.PartyId into PartyDetails from party in PartyDetails.DefaultIfEmpty() join c in _dbContext.CustomerAcctDetails on inf.CustomerId equals c.CustomerId into CustDetails from customer in CustDetails.DefaultIfEmpty() select new MappingGridModel { DatasetId = map.DatasetId, DatasetName = ds.DatasetName, TableName = L.TableName, InterfaceId = inf.InterfaceId, InterfaceName = inf.InterfaceName, CustomerId = (customer != null) ? customer.CustomerId : -1, CustomerName = ((customer != null && customer.CustomerName != null) ? customer.CustomerName : string.Empty), PartyId = (party != null) ? party.PartyId : -1, //((party != null && party.PartyId != null) ? party.PartyId : null), PartyName = ((party != null && party.PartyName != null) ? party.PartyName : string.Empty), PartyType = ((party != null && party.PartyType != null) ? party.PartyType : string.Empty), CreatedDate = map.CreatedDate, UpdatedDate = map.UpdatedDate, Status = map.Status } ).Distinct().ToList(); //DateTime? createdDate = null; //DateTime? updatedDate = null; //if (lstMasterTableDetails.Count > 0) //{ // createdDate = lstMasterTableDetails[0].CreatedDate; // updatedDate = lstMasterTableDetails[0].UpdatedDate; //} List <MappingGridModel> lstTempTableDetails = (from map in _dbContext.LandingToCoreTempDetails join L in _dbContext.LandingTableDetails on map.LandingDetailId equals L.LandingDetailId join ds in _dbContext.DatasetMaster on map.DatasetId equals ds.DatasetId join inf in _dbContext.InterfaceMaster on ds.InterfaceId equals inf.InterfaceId join p in _dbContext.PartyAcctDetails on inf.PartyId equals p.PartyId into PartyDetails from party in PartyDetails.DefaultIfEmpty() join c in _dbContext.CustomerAcctDetails on inf.CustomerId equals c.CustomerId into CustDetails from customer in CustDetails.DefaultIfEmpty() select new MappingGridModel { DatasetId = map.DatasetId, DatasetName = ds.DatasetName, TableName = L.TableName, InterfaceId = inf.InterfaceId, InterfaceName = inf.InterfaceName, CustomerId = (customer != null) ? customer.CustomerId : -1, CustomerName = ((customer != null && customer.CustomerName != null) ? customer.CustomerName : string.Empty), PartyId = (party != null) ? party.PartyId : -1, //((party != null && party.PartyId != null) ? party.PartyId : null), PartyName = ((party != null && party.PartyName != null) ? party.PartyName : string.Empty), PartyType = ((party != null && party.PartyType != null) ? party.PartyType : string.Empty), CreatedDate = map.CreatedDate, UpdatedDate = map.UpdatedDate, Status = map.Status } ).Distinct().ToList(); lstTempTableDetails.ForEach(row => { int count = lstMasterTableDetails.Where(x => x.DatasetId == row.DatasetId).Count(); if (count <= 0) { lstMasterTableDetails.Add(row); } }); } } catch { throw; } return((from map in lstMasterTableDetails let updated = map.UpdatedDate ?? map.CreatedDate orderby updated descending select map).ToList()); }