// GET: /Create public ActionResult Create(int id) { Meeting meeting = new Meeting(); meeting = meetingRepository.GetGroup(id); //Check Exists if (meeting == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } MeetingPNROutputVM meetingPNROutputVM = new MeetingPNROutputVM(); MeetingPNROutput meetingPNROutput = new MeetingPNROutput(); meetingPNROutputVM.MeetingPNROutput = meetingPNROutput; meetingRepository.EditGroupForDisplay(meeting); ViewData["ClientTopUnitGuid"] = meeting.ClientTopUnitGuid; ViewData["ClientTopUnitName"] = meeting.ClientTopUnit.ClientTopUnitName; ViewData["MeetingID"] = meeting.MeetingID; ViewData["MeetingName"] = meeting.MeetingName; meetingPNROutputVM.Meeting = meeting; meetingPNROutput.MeetingID = meeting.MeetingID; //GDS GDSRepository GDSRepository = new GDSRepository(); meetingPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); meetingPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetMeetingPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName", ""); //Languages LanguageRepository languageRepository = new LanguageRepository(); meetingPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName"); //Countries CountryRepository countryRepository = new CountryRepository(); meetingPNROutputVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName"); return(View(meetingPNROutputVM)); }
// GET: /Edit public ActionResult Edit(int id) { MeetingPNROutputVM meetingPNROutputVM = new MeetingPNROutputVM(); MeetingPNROutput meetingPNROutput = new MeetingPNROutput(); meetingPNROutput = meetingPNROutputRepository.GetMeetingPNROutput(id); if (meetingPNROutput == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } meetingPNROutputVM.MeetingPNROutput = meetingPNROutput; //Check Exists Meeting for VM Meeting meeting = new Meeting(); meeting = meetingRepository.GetGroup(meetingPNROutput.MeetingID); if (meeting != null) { meetingRepository.EditGroupForDisplay(meeting); meetingPNROutputVM.Meeting = meeting; } meetingRepository.EditGroupForDisplay(meeting); ViewData["ClientTopUnitGuid"] = meeting.ClientTopUnitGuid; ViewData["ClientTopUnitName"] = meeting.ClientTopUnit.ClientTopUnitName; ViewData["MeetingID"] = meeting.MeetingID; ViewData["MeetingName"] = meeting.MeetingName; meetingPNROutputVM.Meeting = meeting; meetingPNROutput.MeetingID = meeting.MeetingID; //GDS GDSRepository GDSRepository = new GDSRepository(); meetingPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName", meetingPNROutput.GDSCode); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); meetingPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetMeetingPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName", meetingPNROutput.PNROutputRemarkTypeCode); //Languages LanguageRepository languageRepository = new LanguageRepository(); meetingPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName", meetingPNROutput.DefaultLanguageCode); //Countries CountryRepository countryRepository = new CountryRepository(); meetingPNROutputVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName", meetingPNROutput.CountryCode); return(View(meetingPNROutputVM)); }