Ejemplo n.º 1
0
        public static MinistryTimeLineViewModel MapToEventdViewModel(this MinistryTimeLine sectionCardVersion)
        {
            MinistryTimeLineViewModel viewModel = new MinistryTimeLineViewModel()
            {
                Id               = sectionCardVersion.Id,
                EnName           = sectionCardVersion.EnName,
                ArName           = sectionCardVersion.ArName,
                EnDescription    = sectionCardVersion.EnDescription,
                ArDescription    = sectionCardVersion.ArDescription,
                Order            = sectionCardVersion.Order,
                IsActive         = sectionCardVersion.IsActive,
                ProfileImageUrl  = sectionCardVersion.ProfileImageUrl,
                StartDate        = sectionCardVersion.StartDate,
                EndDate          = sectionCardVersion.EndDate,
                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,

                IsDeleted    = sectionCardVersion.IsDeleted,
                CreationDate = sectionCardVersion.CreationDate,
                CreatedById  = sectionCardVersion.CreatedById
            };

            return(viewModel);
        }
Ejemplo n.º 2
0
        public static MinistryTimeLine MapToMinistryTimeLine(this MinistryTimeLineViewModel sectionCardCreateViewModel)
        {
            MinistryTimeLine pageSectionVersion = new MinistryTimeLine();

            pageSectionVersion.EnName           = sectionCardCreateViewModel.EnName;
            pageSectionVersion.ArName           = sectionCardCreateViewModel.ArName;
            pageSectionVersion.EnDescription    = sectionCardCreateViewModel.EnDescription;
            pageSectionVersion.ArDescription    = sectionCardCreateViewModel.ArDescription;
            pageSectionVersion.ProfileImageUrl  = sectionCardCreateViewModel.ProfileImageUrl;
            pageSectionVersion.Order            = sectionCardCreateViewModel.Order;
            pageSectionVersion.IsActive         = sectionCardCreateViewModel.IsActive;
            pageSectionVersion.StartDate        = sectionCardCreateViewModel.StartDate;
            pageSectionVersion.EndDate          = sectionCardCreateViewModel.EndDate;
            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;
            if (sectionCardCreateViewModel.Id > 0)
            {
                pageSectionVersion.Id = sectionCardCreateViewModel.Id;
            }
            //else
            //    pageSectionVersion.Id = 5;
            return(pageSectionVersion);
        }
        public IActionResult Edit(int id)
        {
            MinistryTimeLine pageSectionCardVersion = _ministryTimeLineRepository.GetDetail(id);


            MinistryTimeLineViewModel viewModel = pageSectionCardVersion.MapToEventdViewModel();

            return(View(viewModel));
        }
        public async Task <IActionResult> EditAsync(MinistryTimeLineViewModel sectionCardViewModel)
        {
            if (ModelState.IsValid)
            {
                MinistryTimeLine sectionCardVersion = sectionCardViewModel.MapToMinistryTimeLine();

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

                sectionCardVersion.ApprovedBy   = user;// user.Id.ToString();
                sectionCardVersion.ApprovedById = user.Id.ToString();
                sectionCardVersion.ApprovalDate = DateTime.Now;
                sectionCardVersion.CreationDate = DateTime.Now;
                sectionCardVersion.StatusId     = (int)RequestStatus.Approved;
                if (sectionCardViewModel.Photo != null)
                {
                    sectionCardVersion.ProfileImageUrl = _fileService.UploadImageUrl(sectionCardViewModel.Photo);
                }


                MinistryTimeLine newSectionCardVersion = _ministryTimeLineRepository.Update(sectionCardVersion);
                if (newSectionCardVersion != null)
                {
                    _toastNotification.AddSuccessToastMessage(ToasrMessages.EditSuccess);

                    _eventLogger.LogInfoEvent(HttpContext.User.Identity.Name, Common.ActivityEnum.Update, "Static Page > Ministry Time Line > Edit", sectionCardViewModel.EnName);

                    return(RedirectToAction("Index", new { id = newSectionCardVersion.Id }));
                }
                else
                {
                    _eventLogger.LogInfoEvent(HttpContext.User.Identity.Name, Common.ActivityEnum.Warning, "Static Page > Ministry Time Line > Edit", sectionCardViewModel.EnName);
                    _toastNotification.AddErrorToastMessage(ToasrMessages.warning);
                }
            }

            return(View(sectionCardViewModel));
        }
        public async Task <IActionResult> CreateAsync(MinistryTimeLineViewModel pageMinistryViewModel)
        {
            pageMinistryViewModel.StartDate = Convert.ToDateTime(pageMinistryViewModel.EventDateRange.Split('-')[0]);
            pageMinistryViewModel.EndDate   = Convert.ToDateTime(pageMinistryViewModel.EventDateRange.Split('-')[1]);

            if (ModelState.IsValid)
            {
                MinistryTimeLine sectionCardVersion = pageMinistryViewModel.MapToMinistryTimeLine();// .MapToPageMinistry();

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

                sectionCardVersion.StatusId     = (int)RequestStatus.Approved;
                sectionCardVersion.CreatedById  = user.Id;
                sectionCardVersion.CreationDate = DateTime.Now;
                sectionCardVersion.ApprovedById = user.Id;
                sectionCardVersion.ApprovedBy   = user;
                sectionCardVersion.ApprovalDate = DateTime.Now;

                if (pageMinistryViewModel.Photo != null)
                {
                    sectionCardVersion.ProfileImageUrl = _fileService.UploadImageUrl(pageMinistryViewModel.Photo);
                }
                MinistryTimeLine newPageSectionCardVersion = _ministryTimeLineRepository.Add(sectionCardVersion);
                if (newPageSectionCardVersion != null)
                {
                    _toastNotification.AddSuccessToastMessage(ToasrMessages.AddSuccess);
                    _eventLogger.LogInfoEvent(HttpContext.User.Identity.Name, Common.ActivityEnum.Add, "Static Page > Ministry Time Line > Edit", pageMinistryViewModel.EnName);
                    return(RedirectToAction("Index", new { id = newPageSectionCardVersion.Id }));
                }
                else
                {
                    _eventLogger.LogInfoEvent(HttpContext.User.Identity.Name, Common.ActivityEnum.Warning, "Static Page > Ministry Time Line > Edit", pageMinistryViewModel.EnName);
                    _toastNotification.AddErrorToastMessage(ToasrMessages.warning);
                }
            }
            return(View(pageMinistryViewModel));
        }
        public IActionResult Create(int pageRouteVersionId)
        {
            MinistryTimeLineViewModel viewModel = new MinistryTimeLineViewModel();

            return(View(viewModel));
        }