public ActionResult AircraftDocumentEdit( System.Guid aircraftDocumentId ) { ViewBag.AircraftDocumentId = aircraftDocumentId; var aircraftDocumentContract = new AircraftDocumentContract(); aircraftDocumentContract.AircraftDocument = new CrudeAircraftDocumentServiceClient().FetchByAircraftDocumentId(aircraftDocumentId); ViewBag.AircraftId = new SelectList(new CrudeAircraftServiceClient().FetchAll(), "AircraftId", "AircraftName", aircraftDocumentContract.AircraftDocument.AircraftId ); ViewBag.AircraftDocumentTypeRcd = new SelectList(new CrudeAircraftDocumentTypeRefServiceClient().FetchAll(), "AircraftDocumentTypeRcd", "AircraftDocumentTypeName", aircraftDocumentContract.AircraftDocument.AircraftDocumentTypeRcd ); ViewBag.DefaultUserName = new CrudeDefaultUserServiceClient().FetchByDefaultUserId(aircraftDocumentContract.AircraftDocument.UserId).DefaultUserName; return(View( "~/Views/Templates/Aircraft/AircraftDocument/AircraftDocumentEdit.cshtml", aircraftDocumentContract )); }
public ActionResult AircraftDocumentCreate(System.Guid?aircraftId, System.Guid?userId) { var aircraftDocumentContract = new AircraftDocumentContract(); aircraftDocumentContract.AircraftDocument = new CrudeAircraftDocumentContract(); if (aircraftId != null) { aircraftDocumentContract.AircraftDocument.AircraftId = (System.Guid)aircraftId; } if (userId != null) { aircraftDocumentContract.AircraftDocument.UserId = (System.Guid)userId; } ViewBag.AircraftId = new SelectList(new CrudeAircraftServiceClient().FetchAll(), "AircraftId", "AircraftName", aircraftDocumentContract.AircraftDocument.AircraftId ); ViewBag.AircraftDocumentTypeRcd = new SelectList(new CrudeAircraftDocumentTypeRefServiceClient().FetchAll(), "AircraftDocumentTypeRcd", "AircraftDocumentTypeName", aircraftDocumentContract.AircraftDocument.AircraftDocumentTypeRcd ); aircraftDocumentContract.AircraftDocument.DocumentDateTime = DateTime.UtcNow; aircraftDocumentContract.AircraftDocument.ExpiryDateTime = DateTime.UtcNow; if (userId == null) { aircraftDocumentContract.AircraftDocument.UserId = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}"); } ViewBag.DefaultUserName = new CrudeDefaultUserServiceClient().FetchByDefaultUserId(aircraftDocumentContract.AircraftDocument.UserId).DefaultUserName; aircraftDocumentContract.AircraftDocument.DateTime = DateTime.UtcNow; return(View( "~/Views/Templates/Aircraft/AircraftDocument/AircraftDocumentCreate.cshtml", aircraftDocumentContract )); }
public ActionResult AircraftDocumentCreate([Bind()] AircraftDocumentContract aircraftDocumentContract, System.Guid aircraftId, System.String aircraftDocumentTypeRcd) { if (ModelState.IsValid) { aircraftDocumentContract.AircraftDocument.AircraftId = aircraftId; aircraftDocumentContract.AircraftDocument.AircraftDocumentTypeRcd = aircraftDocumentTypeRcd; new CrudeAircraftDocumentServiceClient().Insert(aircraftDocumentContract.AircraftDocument); return(RedirectToAction("AircraftDocumentIndex", new { aircraftId = aircraftDocumentContract.AircraftDocument.AircraftId })); } return(View( "~/Views/Templates/Aircraft/AircraftDocument/AircraftDocumentCreate.cshtml", aircraftDocumentContract )); }