public static void UpdateBundleEntity(this CRS_Bundles entity, BundleEditDTO dto) { entity.BundleName = dto.BundleName.TrimString(); entity.BundleUrlName = dto.BundleName.TrimString().OptimizedUrl(); entity.BundleDescription = dto.Description.TrimString(); entity.OverviewVideoIdentifier = dto.PromoVideoIdentifier.ToString(); entity.BannerImage = dto.ThumbName; entity.StatusId = (short)dto.Status; entity.MetaTags = dto.MetaTags; entity.UpdateDate = DateTime.Now; entity.UpdatedBy = DtoExtensions.CurrentUserId; if (entity.PublishDate == null && dto.Status == CourseEnums.CourseStatus.Published) { entity.PublishDate = DateTime.Now; } }
public static CRS_Bundles EditDto2BundleEntity(this BundleEditDTO dto, int authorId) { return(new CRS_Bundles { AuthorId = authorId , uid = dto.Uid , BundleName = dto.BundleName.TrimString() , BundleUrlName = dto.BundleName.TrimString().OptimizedUrl() , StatusId = (short)dto.Status , BundleDescription = dto.Description.TrimString() , OverviewVideoIdentifier = dto.PromoVideoIdentifier.ToString() , BannerImage = dto.ThumbName , MetaTags = dto.MetaTags , AddOn = DateTime.Now , CreatedBy = DtoExtensions.CurrentUserId }); }
public static BundleEditDTO BundleEntity2BundleEditDto(this CRS_Bundles entity, bool isAnyPrices) { var token = new BundleEditDTO { BundleId = entity.BundleId , Uid = entity.uid , AuthorId = entity.AuthorId , BundleName = entity.BundleName , Description = entity.BundleDescription , MetaTags = entity.MetaTags , Status = Utils.ParseEnum <CourseEnums.CourseStatus>(entity.StatusId.ToString()) , ThumbName = entity.BannerImage , ThumbUrl = entity.BannerImage.ToThumbUrl(Constants.ImageBaseUrl) , IsBundlePurchased = entity.USER_Bundles.ToList().Any() , IsPriceDefined = isAnyPrices , HasCourses = entity.CRS_BundleCourses.ToList().Any() , Categories = new List <int>() }; if (String.IsNullOrEmpty(entity.OverviewVideoIdentifier)) { token.PromoVideoIdentifier = null; } else { long bcId; var parsed = Int64.TryParse(entity.OverviewVideoIdentifier, out bcId); if (parsed) { token.PromoVideoIdentifier = bcId; } } return(token); }