コード例 #1
0
        public ActionResult Index(string eid)
        {
            eid = _encryptionService.DecryptString2(eid);
            Int32 eduId = 0;

            if (eid == "" || eid == null)
            {
                eduId = EducationID;
            }
            else
            {
                eduId = Convert.ToInt32(eid);
            }
            EducationID = eduId;
            EducationTypesAvailableViewModel EducationTypesAvailableViewModel = new Domain.ViewModels.EducationTypeAvailableViewModel.EducationTypesAvailableViewModel();

            EducationTypesAvailableViewModel.EducationTypesAvailableResults = Mapper.Map <IEnumerable <EducationTypesAvailable> >(_educationService.GetEducationTypeByEducationID(eduId));
            EducationTypesAvailableViewModel.EducationDetailPageResults     = Mapper.Map <EducationDetailPageWithEducation>(_educationService.GetEducationDetailPageContent(eduId));
            EducationTypesAvailableViewModel.EducationCredentialResults     = Mapper.Map <IEnumerable <EducationCredential> >(_educationService.GetEducationCredentialByEducationID(eduId));
            EducationTypesAvailableViewModel.Education = Mapper.Map <Education>(_educationService.GetEducationByID(eduId));
            //   string a = EducationTypesAvailableViewModel.Education.CourseStartDate.ToString("yyyy-MM-dd");

            if (EducationTypesAvailableViewModel.Education.CourseStartDate <= DateTime.Now && EducationTypesAvailableViewModel.Education.CourseEndDate > DateTime.Now)
            {
                EducationTypesAvailableViewModel.Education.CanPurchase = true;
            }
            else
            {
                EducationTypesAvailableViewModel.Education.CanPurchase = false;
            }
            string decodedHTML = HttpUtility.HtmlDecode(EducationTypesAvailableViewModel.EducationDetailPageResults.PContent);

            if (decodedHTML != null)
            {
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = decodedHTML.Replace(GlobalConst.Message.SlashStoragePath, GlobalConst.Message.StoragePath);
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = EducationTypesAvailableViewModel.EducationDetailPageResults.PContent.Replace("/richtexteditor/", GlobalConst.Extension.http + GlobalConst.ConstantChar.Colon + GlobalConst.ConstantChar.ForwardSlash + GlobalConst.ConstantChar.ForwardSlash + Request.Url.Host.ToLower() + GlobalConst.ConstantChar.Colon + Request.Url.Port + "/richtexteditor/");
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = EducationTypesAvailableViewModel.EducationDetailPageResults.PContent.Replace("&nbsp;", "");
            }
            else
            {
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = EducationTypesAvailableViewModel.EducationDetailPageResults.PContent;
            }
            return(View(EducationTypesAvailableViewModel));
        }