public ActionResult Reports(int Id) { // the general info about the factory var factoryy = db.Factory11.FirstOrDefault(p => p.Id == Id); if (factoryy != null) { FactoryGeneralInfoVM factoryGeneralInfovm = new FactoryGeneralInfoVM(); var factory = db.Factory11.FirstOrDefault(p => p.Id == Id); factoryGeneralInfovm.FactoryId = factory.Id; factoryGeneralInfovm.DailyProductionRate = factory.DailyProductionRate; factoryGeneralInfovm.FactoryFaxNumber = factory.FaxNumber; factoryGeneralInfovm.FactoryName = factory.Name; factoryGeneralInfovm.FactoryPhoneNumber = factory.PhoneNumber; factoryGeneralInfovm.Location = db.Locations.FirstOrDefault(p => p.Id == factory.Location_Id).Location_Arabic; factoryGeneralInfovm.ManagerName = factory.ManagerName; factoryGeneralInfovm.ManagerQualification = factory.ManagerExperience; factoryGeneralInfovm.OwnerName = factory.OwnerName; factoryGeneralInfovm.ProductionCapacity = factory.ProductionCapacity; ViewBag.GeneralInfo = factoryGeneralInfovm; var factoryEvaluationReports = db.FactoryEvaluationReports.Where(p => p.FactoryId == factoryy.Id).Include(f => f.Factory).ToList(); return(View(factoryEvaluationReports)); } return(View()); }
public ActionResult Create(int Id) { // the general info about the factory FactoryGeneralInfoVM factoryGeneralInfovm = new FactoryGeneralInfoVM(); var factory = db.Factory11.FirstOrDefault(p => p.Id == Id); factoryGeneralInfovm.FactoryId = factory.Id; factoryGeneralInfovm.DailyProductionRate = factory.DailyProductionRate; factoryGeneralInfovm.FactoryFaxNumber = factory.FaxNumber; factoryGeneralInfovm.FactoryName = factory.Name; factoryGeneralInfovm.FactoryPhoneNumber = factory.PhoneNumber; factoryGeneralInfovm.Location = db.Locations.FirstOrDefault(p => p.Id == factory.Location_Id).Location_Arabic; factoryGeneralInfovm.ManagerName = factory.ManagerName; factoryGeneralInfovm.ManagerQualification = factory.ManagerExperience; factoryGeneralInfovm.OwnerName = factory.OwnerName; factoryGeneralInfovm.ProductionCapacity = factory.ProductionCapacity; ViewBag.ListOfQualifications = db.EquipmentRequirementsTypes.ToList(); ViewBag.GeneralInfo = factoryGeneralInfovm; return(View()); }