public static PageMinistry MapToPageMinistry(this PageMinistryEditViewModel sectionCardCreateViewModel) { PageMinistry pageSectionVersion = new PageMinistry(); pageSectionVersion.EnName = sectionCardCreateViewModel.EnName; pageSectionVersion.ArName = sectionCardCreateViewModel.ArName; pageSectionVersion.EnContent = sectionCardCreateViewModel.EnContent; pageSectionVersion.ArContent = sectionCardCreateViewModel.ArContent; pageSectionVersion.ImageUrl = sectionCardCreateViewModel.ImageUrl; pageSectionVersion.EnImageUrl = sectionCardCreateViewModel.EnImageUrl; pageSectionVersion.IsActive = sectionCardCreateViewModel.IsActive; pageSectionVersion.IsDeleted = sectionCardCreateViewModel.IsDeleted; pageSectionVersion.IsDobulQuote = sectionCardCreateViewModel.IsDobulQuote; pageSectionVersion.Order = sectionCardCreateViewModel.Order; pageSectionVersion.IsSection = sectionCardCreateViewModel.IsSection; pageSectionVersion.PageRouteId = sectionCardCreateViewModel.PageRouteId; 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; } return(pageSectionVersion); }
public static PageMinistryEditViewModel MapToSctionCardViewModel(this PageMinistry sectionCardCreateViewModel) { PageMinistryEditViewModel viewModel = new PageMinistryEditViewModel() { Id = sectionCardCreateViewModel.Id, EnName = sectionCardCreateViewModel.EnName, ArName = sectionCardCreateViewModel.ArName, EnContent = sectionCardCreateViewModel.EnContent, ArContent = sectionCardCreateViewModel.ArContent, IsActive = sectionCardCreateViewModel.IsActive, IsDeleted = sectionCardCreateViewModel.IsDeleted, IsDobulQuote = sectionCardCreateViewModel.IsDobulQuote, ImageUrl = sectionCardCreateViewModel.ImageUrl, EnImageUrl = sectionCardCreateViewModel.EnImageUrl, Order = sectionCardCreateViewModel.Order, IsSection = sectionCardCreateViewModel.IsSection, SeoTitleEN = sectionCardCreateViewModel.SeoTitleEN, SeoTitleAR = sectionCardCreateViewModel.SeoTitleAR, SeoDescriptionEN = sectionCardCreateViewModel.SeoDescriptionEN, SeoDescriptionAR = sectionCardCreateViewModel.SeoDescriptionAR, SeoOgTitleEN = sectionCardCreateViewModel.SeoOgTitleEN, SeoOgTitleAR = sectionCardCreateViewModel.SeoOgTitleAR, SeoTwitterCardEN = sectionCardCreateViewModel.SeoTwitterCardEN, SeoTwitterCardAR = sectionCardCreateViewModel.SeoTwitterCardAR, PageRouteId = sectionCardCreateViewModel.PageRouteId ?? 0, VersionStatusEnum = VersionStatusEnum.Draft, ChangeActionEnum = ChangeActionEnum.Update, PageMinistryId = sectionCardCreateViewModel.Id }; return(viewModel); }
public PageMinistry Add(PageMinistry pageMinistry) { try { pageMinistry.StatusId = (int)RequestStatus.Approved; _db.PageMinistry.Add(pageMinistry); _db.SaveChanges(); //return _db.PageMinistry.Include(x => x.PageRouteVersion).FirstOrDefault(c => c.Id == pageMinistry.Id); return(_db.PageMinistry.FirstOrDefault(c => c.Id == pageMinistry.Id)); } catch (Exception ex) { return(null); } }
public PageMinistry Update(PageMinistry pageMinistry) { try { pageMinistry.CreationDate = DateTime.Now; pageMinistry.StatusId = (int)RequestStatus.Approved; _db.PageMinistry.Attach(pageMinistry); _db.Entry(pageMinistry).State = EntityState.Modified; _db.SaveChanges(); return(_db.PageMinistry.FirstOrDefault(c => c.Id == pageMinistry.Id)); } catch (Exception ex) { return(null); } }