/// <summary> /// Save Page Specific Placeholder /// </summary> /// <param name="tblPageSpecificPlaceholderConfigDto"></param> /// <returns></returns> public int SavePageSpecificPlaceholder(tblPageSpecificPlaceholderConfigDto tblPageSpecificPlaceholderConfigDto) { using (var fpCofigDataContext = new FPConfigEntities()) { int result = 0; Mapper.CreateMap<tblPageSpecificPlaceholderConfigDto, tblPageSpecificPlaceholderConfig>(); //update if (tblPageSpecificPlaceholderConfigDto.Id > 0) { var tblPageSpecificPlaceholderConfig = fpCofigDataContext.tblPageSpecificPlaceholderConfigs.Find(tblPageSpecificPlaceholderConfigDto.Id); tblPageSpecificPlaceholderConfigDto.CreatedBy = tblPageSpecificPlaceholderConfig.CreatedBy; tblPageSpecificPlaceholderConfigDto.CreatedOn = tblPageSpecificPlaceholderConfig.CreatedOn; Mapper.Map(tblPageSpecificPlaceholderConfigDto, tblPageSpecificPlaceholderConfig); fpCofigDataContext.SaveChanges(); result = tblPageSpecificPlaceholderConfig.Id; }//add else { var tblPageSpecificPlaceholderConfig = new tblPageSpecificPlaceholderConfig(); Mapper.Map(tblPageSpecificPlaceholderConfigDto, tblPageSpecificPlaceholderConfig); fpCofigDataContext.tblPageSpecificPlaceholderConfigs.Add(tblPageSpecificPlaceholderConfig); fpCofigDataContext.SaveChanges(); result = tblPageSpecificPlaceholderConfig.Id; } return result; } }
/// <summary> /// Save Page Specific Placeholder /// </summary> /// <param name="tblPageSpecificPlaceholderConfigDto"></param> /// <returns></returns> public int SavePageSpecificPlaceholder(PageSpecificPlaceholderConfigBO pageSpecificPlaceholderConfigBO) { Mapper.CreateMap<PageSpecificPlaceholderConfigBO, tblPageSpecificPlaceholderConfigDto>(); var tblPageSpecificPlaceholderConfigDto = new tblPageSpecificPlaceholderConfigDto(); Mapper.Map(pageSpecificPlaceholderConfigBO, tblPageSpecificPlaceholderConfigDto); var pageSpecificPlaceholderConfigProvider = new PageSpecificPlaceholderConfigProvider(); return pageSpecificPlaceholderConfigProvider.SavePageSpecificPlaceholder(tblPageSpecificPlaceholderConfigDto); }