public MaintenanceOrder FirstMaintenanceOrder() { var firstMaintenanceOrder = new MaintenanceOrder { MaintenanceID = new Int32() , UnitID = new Int32() , MaintenanceDate = new DateTime() , UrgencyID = new Int32() , Description = null, ServiceTypeID = new Int32() , PetsinUnit = new Boolean() , TenantPresence = new Boolean() , //Skipping MaintenanceCrew Collection ServiceType = new ServiceType() , UrgencyType = new UrgencyType() , //Skipping MaintenancePhoto Collection //Skipping OwnerMaintenance Collection TenantMaintenance = new TenantMaintenance() }; return firstMaintenanceOrder; }
public ActionResult Edit(MaintenanceOrder maintenanceorder) { if (ModelState.IsValid) { UnitofWork.MaintenanceOrderRepository.Edit(maintenanceorder); UnitofWork.Save(); return RedirectToAction("Index"); } ViewBag.ServiceTypeID = new SelectList(UnitofWork.ServiceTypeRepository.All, "ServiceTypeID", "ServiceType1", maintenanceorder.ServiceTypeID); ViewBag.UrgencyID = new SelectList(UnitofWork.UrgencyTypeRepository.All, "UrgencyTypeID", "UrgencyType1", maintenanceorder.UrgencyID); return View(maintenanceorder); }