public SecondrySourceWithFullLoads GetSecondaryLoads(int Id) { SecondrySourceWithFullLoads Result = new SecondrySourceWithFullLoads(); var Query = _Context.secondarySource.Include(f => f.Loads).SingleOrDefault(f => f.Code == Id.ToString()); if (Query != null) { Result = MappingToFactoryFullDataAsync(Query); } return(Result); }
public SecondrySourceWithFullLoads MappingToFactoryFullDataAsync(secondarySource obj) { SecondrySourceWithFullLoads MappedObj = new SecondrySourceWithFullLoads() { Id = obj.Id, Code = obj.Code, Name = obj.Name, PrimarySourceId = obj.PrimarySourceId, PrimarySource = obj.PrimarySource }; foreach (var item in obj.Loads) { MappedObj.Loads.Add(new Load() { Id = item.Id, Connection = item.Connection, Function = item.Function, code = item.code, }); } return(MappedObj); }