// GET: RpasUser/Edit/5 public ActionResult Edit(int?id) { if (!exLogic.User.hasAccess("RPASUSER.EDIT")) { return(RedirectToAction("NoAccess", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MSTR_User mSTR_User = db.MSTR_User.Find(id); MSTR_User_Pilot mSTR_User_Pilot = db.MSTR_User_Pilot.Find(id); if (mSTR_User == null) { return(HttpNotFound()); } var viewModel = new ViewModel.UserViewModel { User = mSTR_User, Pilot = mSTR_User_Pilot, ProfileList = Util.GetProfileList(), CountryList = Util.GetCountryLists("Country", "CountryName", "Code", "sp"), AccountList = Util.GetAccountList(), DashboardList = Util.GetDashboardLists(), PermitCategoryList = Util.GetLists("RPASCategory") }; return(View(viewModel)); //return View(mSTR_User); }
public PilotEditModel(int UserID) { ExponentPortalEntities db = new ExponentPortalEntities(); MSTR_User mSTR_User = db.MSTR_User.Find(UserID); if (mSTR_User == null) { this.UserId = 0; return; } this.UserId = mSTR_User.UserId; this.UserName = mSTR_User.UserName; this.PhotoUrl = mSTR_User.PhotoUrl; this.FirstName = mSTR_User.FirstName; this.MiddleName = mSTR_User.MiddleName; this.LastName = mSTR_User.LastName; this.Remarks = mSTR_User.Remarks; this.MobileNo = mSTR_User.MobileNo; this.HomeNo = mSTR_User.HomeNo; this.EmailId = mSTR_User.EmailId; this.CountryId = mSTR_User.CountryId; this.RPASPermitNo = mSTR_User.RPASPermitNo; this.PermitCategory = mSTR_User.PermitCategory; this.ContactAddress = mSTR_User.ContactAddress; this.RegRPASSerialNo = mSTR_User.RegRPASSerialNo; this.EmiratesID = mSTR_User.EmiratesID; this.DOI_RPASPermit = mSTR_User.DOI_RPASPermit; this.DOE_RPASPermit = mSTR_User.DOE_RPASPermit; this.UserDescription = mSTR_User.UserDescription; this.Nationality = mSTR_User.Nationality; this.AccountID = mSTR_User.AccountId.Value; MSTR_User_Pilot mSTR_User_Pilot = db.MSTR_User_Pilot.Find(UserId); if (mSTR_User_Pilot != null) { this.Department = mSTR_User_Pilot.Department; this.PassportNo = mSTR_User_Pilot.PassportNo; this.DateOfExpiry = mSTR_User_Pilot.DateOfExpiry; this.EmiratesID = mSTR_User_Pilot.EmiratesId; } this.LinkedDroneID = db.M2M_Drone_User .Where(w => w.UserID == UserId) .Select(s => s.DroneID) .ToList(); }