public IActionResult Create(int pageRouteId)
        {
            PageEventVersionViewModel viewModel = new PageEventVersionViewModel();

            viewModel.PageRouteId = pageRouteId;
            return(View(viewModel));
        }
Exemplo n.º 2
0
        public static PageEventVersions MapToPageEventVersion(this PageEventVersionViewModel sectionCardCreateViewModel)
        {
            PageEventVersions pageSectionVersion = new PageEventVersions();

            pageSectionVersion.EnTitle       = sectionCardCreateViewModel.EnTitle;
            pageSectionVersion.ArTitle       = sectionCardCreateViewModel.ArTitle;
            pageSectionVersion.EnDescription = sectionCardCreateViewModel.EnDescription;
            pageSectionVersion.ArDescription = sectionCardCreateViewModel.ArDescription;
            pageSectionVersion.EnImageAlt    = sectionCardCreateViewModel.EnImageAlt;
            pageSectionVersion.ArImageAlt    = sectionCardCreateViewModel.ArImageAlt;
            pageSectionVersion.EnUrl         = sectionCardCreateViewModel.Url;
            pageSectionVersion.ArUrl         = sectionCardCreateViewModel.DetailUrl;
            pageSectionVersion.Order         = sectionCardCreateViewModel.Order;
            pageSectionVersion.IsActive      = sectionCardCreateViewModel.IsActive;
            pageSectionVersion.EnAddress     = sectionCardCreateViewModel.EnAddress;
            pageSectionVersion.ArAddress     = sectionCardCreateViewModel.ArAddress;

            pageSectionVersion.EventLocation    = sectionCardCreateViewModel.EventLocation;
            pageSectionVersion.EventLocationUrl = sectionCardCreateViewModel.EventLocationUrl;
            pageSectionVersion.EventDateColor   = sectionCardCreateViewModel.EventDateColor;

            //if (sectionCardCreateViewModel.EventDateRange != null)
            //{
            pageSectionVersion.EventStartDate = sectionCardCreateViewModel.EventStartDate;
            pageSectionVersion.EventEndDate   = sectionCardCreateViewModel.EventEndDate;
            //}



            pageSectionVersion.EventSocialLinks = sectionCardCreateViewModel.EventSocialLinks;


            pageSectionVersion.SeoTitleEN       = sectionCardCreateViewModel.SeoTitleEN;
            pageSectionVersion.SeoTitleAR       = sectionCardCreateViewModel.SeoTitleAR;
            pageSectionVersion.SeoDescriptionEN = sectionCardCreateViewModel.SeoDescriptionEN;
            pageSectionVersion.SeoDescriptionAR = sectionCardCreateViewModel.SeoDescriptionAR;
            pageSectionVersion.SeoOgTitleEN     = sectionCardCreateViewModel.SeoOgTitleEN;
            pageSectionVersion.SeoOgTitleAR     = sectionCardCreateViewModel.SeoOgTitleAR;
            pageSectionVersion.SeoTwitterCardEN = sectionCardCreateViewModel.SeoTwitterCardEN;
            pageSectionVersion.SeoTwitterCardAR = sectionCardCreateViewModel.SeoTwitterCardAR;


            pageSectionVersion.PageRouteVersionId = sectionCardCreateViewModel.PageRouteId;
            if (sectionCardCreateViewModel.Id > 0)
            {
                pageSectionVersion.Id = sectionCardCreateViewModel.Id;
            }
            //else
            //    pageSectionVersion.Id = 5;
            return(pageSectionVersion);
        }
        public async Task <IActionResult> EditAsync(PageEventVersionViewModel eventVersionViewModel)
        {
            eventVersionViewModel.EventStartDate = Convert.ToDateTime(eventVersionViewModel.EventDateRange.Split('-')[0]);
            eventVersionViewModel.EventEndDate   = Convert.ToDateTime(eventVersionViewModel.EventDateRange.Split('-')[1]);

            if (ModelState.IsValid)
            {
                PageEventVersions eventVersion = eventVersionViewModel.MapToPageEventVersion();

                var user = await _userManager.GetUserAsync(HttpContext.User);

                eventVersion.ApprovedBy   = user;
                eventVersion.ApprovedById = user.Id.ToString();
                eventVersion.ApprovalDate = DateTime.Now;
                eventVersion.CreationDate = DateTime.Now;
                if (eventVersionViewModel.Photo != null)
                {
                    eventVersion.EnUrl = _fileService.UploadImageUrlNew(eventVersionViewModel.Photo);
                }
                if (eventVersionViewModel.DetailPhoto != null)
                {
                    eventVersion.ArUrl = _fileService.UploadImageUrlNew(eventVersionViewModel.DetailPhoto);
                }


                PageEventVersions newEventVer = _pageEventVersionRepository.Update(eventVersion, eventVersionViewModel.PageRouteId);
                if (newEventVer != null)
                {
                    _toastNotification.AddSuccessToastMessage(ToasrMessages.EditSuccess);

                    _eventLogger.LogInfoEvent(HttpContext.User.Identity.Name, Common.ActivityEnum.Update, "Page Event", eventVersionViewModel.EnTitle);

                    return(RedirectToAction("Index", new { pageRouteId = eventVersionViewModel.PageRouteId }));
                }
                else
                {
                    _toastNotification.AddErrorToastMessage(ToasrMessages.warning);
                }
            }

            return(View(eventVersionViewModel));
        }
Exemplo n.º 4
0
        public static ViewPageEventVersions MapToPageEventVersionViewModel(this PageEventVersionViewModel sectionCardVersion)
        {
            return(new ViewPageEventVersions
            {
                Id = sectionCardVersion.Id,
                EnTitle = sectionCardVersion.EnTitle,
                ArTitle = sectionCardVersion.ArTitle,
                EnDescription = sectionCardVersion.EnDescription,
                ArDescription = sectionCardVersion.ArDescription,
                EnImageAlt = sectionCardVersion.EnImageAlt,
                ArImageAlt = sectionCardVersion.ArImageAlt,
                EnUrl = sectionCardVersion.Url,
                ArUrl = sectionCardVersion.Url,
                Order = sectionCardVersion.Order,
                IsActive = sectionCardVersion.IsActive,
                EnAddress = sectionCardVersion.EnAddress,
                ArAddress = sectionCardVersion.ArAddress,
                EventLocation = sectionCardVersion.EventLocation,
                EventLocationUrl = sectionCardVersion.EventLocationUrl,
                EventDateColor = sectionCardVersion.EventDateColor,

                EventStartDate = Convert.ToDateTime(sectionCardVersion.EventStartDate),
                EventEndDate = Convert.ToDateTime(sectionCardVersion.EventEndDate),
                EventSocialLinks = sectionCardVersion.EventSocialLinks,


                SeoTitleEN = sectionCardVersion.SeoTitleEN,
                SeoTitleAR = sectionCardVersion.SeoTitleAR,
                SeoDescriptionEN = sectionCardVersion.SeoDescriptionEN,
                SeoDescriptionAR = sectionCardVersion.SeoDescriptionAR,
                SeoOgTitleEN = sectionCardVersion.SeoOgTitleEN,
                SeoOgTitleAR = sectionCardVersion.SeoOgTitleAR,
                SeoTwitterCardEN = sectionCardVersion.SeoTwitterCardEN,
                SeoTwitterCardAR = sectionCardVersion.SeoTwitterCardAR,
                // FileUrl = sectionCardVersion.FileUrl,
                //SectionVersionId = sectionCardVersion.PageSectionVersionId,
                IsDeleted = sectionCardVersion.IsDeleted,
                CreationDate = sectionCardVersion.CreationDate,
                CreatedById = sectionCardVersion.CreatedById
                              //PageRouteVersionId = sectionCardVersion.PageRouteVersionId
            });
        }
Exemplo n.º 5
0
        public PageEventVersionViewModel GetDetail(int id)
        {
            var eventVer = _db.PageEventVersions.FirstOrDefault(p => p.Id == id);

            if (eventVer != null)
            {
                if (eventVer.VersionStatusEnum == VersionStatusEnum.Approved || eventVer.VersionStatusEnum == VersionStatusEnum.Ignored)
                {
                    var eventModel = _db.PageEvents.FirstOrDefault(p => p.Id == eventVer.PageEventId);
                    PageEventVersionViewModel eventViewModel = new PageEventVersionViewModel
                    {
                        Id               = eventVer.Id,
                        EnTitle          = eventModel.EnTitle,
                        ArTitle          = eventModel.ArTitle,
                        EnDescription    = eventModel.EnDescription,
                        ArDescription    = eventModel.ArDescription,
                        IsActive         = eventModel.IsActive,
                        PageEventId      = eventModel.Id,
                        ArAddress        = eventModel.ArAddress,
                        EventEndDate     = eventModel.EventEndDate,
                        ArImageAlt       = eventModel.ArImageAlt,
                        EnAddress        = eventModel.EnAddress,
                        EnImageAlt       = eventModel.EnImageAlt,
                        EventCaption     = eventModel.EventCaption,
                        EventDateColor   = eventModel.EventDateColor,
                        EventLocation    = eventModel.EventLocation,
                        EventLocationUrl = eventModel.EventLocationUrl,
                        EventSocialLinks = eventModel.EventSocialLinks,
                        EventStartDate   = eventModel.EventStartDate,
                        Order            = eventModel.Order,
                        //ShowInHome= eventModel.ShowInHome,
                        SeoDescriptionAR = eventModel.SeoDescriptionAR,
                        SeoDescriptionEN = eventModel.SeoDescriptionEN,
                        SeoOgTitleAR     = eventModel.SeoOgTitleAR,
                        SeoOgTitleEN     = eventModel.SeoOgTitleEN,
                        SeoTitleAR       = eventModel.SeoTitleAR,
                        SeoTitleEN       = eventModel.SeoTitleEN,
                        SeoTwitterCardAR = eventModel.SeoTwitterCardAR,
                        SeoTwitterCardEN = eventModel.SeoTwitterCardEN,
                        Url       = eventModel.EnUrl,
                        DetailUrl = eventModel.ArUrl
                    };

                    return(eventViewModel);
                }
                else
                {
                    PageEventVersionViewModel eventViewModel = new PageEventVersionViewModel
                    {
                        Id               = eventVer.Id,
                        EnTitle          = eventVer.EnTitle,
                        ArTitle          = eventVer.ArTitle,
                        EnDescription    = eventVer.EnDescription,
                        ArDescription    = eventVer.ArDescription,
                        IsActive         = eventVer.IsActive,
                        PageEventId      = eventVer.PageEventId,
                        ArAddress        = eventVer.ArAddress,
                        EventEndDate     = eventVer.EventEndDate,
                        ArImageAlt       = eventVer.ArImageAlt,
                        EnAddress        = eventVer.EnAddress,
                        EnImageAlt       = eventVer.EnImageAlt,
                        EventCaption     = eventVer.EventCaption,
                        EventDateColor   = eventVer.EventDateColor,
                        EventLocation    = eventVer.EventLocation,
                        EventLocationUrl = eventVer.EventLocationUrl,
                        EventSocialLinks = eventVer.EventSocialLinks,
                        EventStartDate   = eventVer.EventStartDate,
                        Order            = eventVer.Order,
                        //ShowInHome = eventVer.ShowInHome
                        SeoDescriptionAR = eventVer.SeoDescriptionAR,
                        SeoDescriptionEN = eventVer.SeoDescriptionEN,
                        SeoOgTitleAR     = eventVer.SeoOgTitleAR,
                        SeoOgTitleEN     = eventVer.SeoOgTitleEN,
                        SeoTitleAR       = eventVer.SeoTitleAR,
                        SeoTitleEN       = eventVer.SeoTitleEN,
                        SeoTwitterCardAR = eventVer.SeoTwitterCardAR,
                        SeoTwitterCardEN = eventVer.SeoTwitterCardEN,
                        Url       = eventVer.EnUrl,
                        DetailUrl = eventVer.ArUrl
                    };

                    return(eventViewModel);
                }
            }
            return(null);
        }