public List <PressureResistanceTestforFactorySamplePhoto> TestForCompany(int id) { var query = context.ConcreteSample1.Where(c => c.SampleNumber == id).Select(sa => sa.ConcreteRank).FirstOrDefault(); var Photos = context.SampleCubePaths.Where(s => s.SampleNumber == id).FirstOrDefault(); PressureResistanceTestforFactorySamplePhoto p = new PressureResistanceTestforFactorySamplePhoto(); p.SampleNo = id; p.ConcreteRank = int.Parse((query.Split('-'))[1]); p.Age = 28; p.AreaLoaded = 17674; p.Volume = 5302; p.TestDate = DateTime.Now; p.Photo1 = Photos.Cube1P1; p.Photo2 = Photos.Cube1P2; PressureResistanceTestforFactorySamplePhoto p2 = new PressureResistanceTestforFactorySamplePhoto(); p2.SampleNo = id; p2.ConcreteRank = int.Parse((query.Split('-'))[1]); p2.Age = 28; p2.AreaLoaded = 17674; p2.Volume = 5302; p2.TestDate = DateTime.Now; p2.Photo1 = Photos.Cube2P1; p2.Photo2 = Photos.Cube2P2; PressureResistanceTestforFactorySamplePhoto p3 = new PressureResistanceTestforFactorySamplePhoto(); p3.SampleNo = id; p3.ConcreteRank = int.Parse((query.Split('-'))[1]); p3.Age = 28; p3.AreaLoaded = 17674; p3.Volume = 5302; p3.TestDate = DateTime.Now; p3.Photo1 = Photos.Cube3P1; p3.Photo2 = Photos.Cube3P2; List <PressureResistanceTestforFactorySamplePhoto> PressureList = new List <PressureResistanceTestforFactorySamplePhoto>(); PressureList.Add(p); PressureList.Add(p2); PressureList.Add(p3); return(PressureList); }
public List <PressureResistanceTestforFactorySamplePhoto> ViewIndex() { var samples = context.ConcreteSample1.Where(v => DbFunctions.DiffDays(v.ReportDate, DateTime.Now) == 28); List <PressureResistanceTestforFactorySamplePhoto> pList = new List <PressureResistanceTestforFactorySamplePhoto>(); foreach (var item in samples) { SampleCubePath paths = new SampleCubePath(); if (samples != null) { paths = context.SampleCubePaths.Where(s => s.SampleNumber == item.SampleNumber).FirstOrDefault(); } if (paths != null) { PressureResistanceTestforFactorySamplePhoto p = new PressureResistanceTestforFactorySamplePhoto(); p.SampleNo = item.SampleNumber; pList.Add(p); } } return(pList); }