Exemplo n.º 1
0
        public static CourseInfoDTO CourseToken2CourseInfoDto(this CRS_CourseToken token, string trackingId)
        {
            if (token == null)
            {
                return(null);
            }

            var dto = new CourseInfoDTO
            {
                CourseId                   = token.CourseId
                , uid                      = token.uid
                , CourseName               = token.CourseName
                , CourseDescription        = token.CourseDescription
                , IsFreeCourse             = token.IsFreeCourse
                , ThumbUrl                 = token.SmallImage.ToThumbUrl(Constants.ImageBaseUrl)
                , Price                    = token.Price
                , MonthlySubscriptionPrice = token.MonthlySubscriptionPrice
                , OverviewVideoIdentifier  = token.OverviewVideoIdentifier
                , DisplayOtherLearnersTab  = token.DisplayOtherLearnersTab
                , MetaTags                 = token.MetaTags
                , Author                   = new UserInfoDTO
                {
                    UserId       = token.AuthorUserId
                    , FirstName  = token.FirstName
                    , LastName   = token.LastName
                    , FullName   = token.Entity2AuthorFullName()
                    , Email      = token.Email
                    , FacebookId = token.FacebookID
                }
            };

            dto.CoursePageUrl = token.GenerateCourseFullPageUrl(dto.Author.FullName, dto.CourseName, trackingId);

            return(dto);
        }
Exemplo n.º 2
0
        public static CourseFbToken CourseEntity2FbToken(this CRS_CourseToken entity)
        {
            if (entity == null)
            {
                return(null);
            }

            return(new CourseFbToken
            {
                CourseId = entity.CourseId
                , ImageUrl = String.IsNullOrEmpty(entity.SmallImage) ? string.Empty : entity.SmallImage.ToThumbUrl(Constants.ImageBaseUrl)
                , Name = entity.CourseName
                , CoursePageUrl = entity.GenerateCourseFullPageUrl(entity.Entity2AuthorFullName(), entity.CourseName, null)
            });
        }
Exemplo n.º 3
0
 public static ItemPurchaseDataToken CourseToken2ItemPurchaseDataToken(this CRS_CourseToken token)
 {
     return(new ItemPurchaseDataToken
     {
         ItemId = token.CourseId
         , ItemName = token.CourseName
         , Type = BillingEnums.ePurchaseItemTypes.COURSE
         , Price = token.Price.FormatPrice()
         , MonthlySubscriptionPrice = token.MonthlySubscriptionPrice.FormatPrice()
         , Author = new UserBaseDTO
         {
             userId = token.AuthorUserId
             , fullName = token.Entity2AuthorFullName()
         }
     });
 }
Exemplo n.º 4
0
 public static string Entity2AuthorFullName(this CRS_CourseToken entity)
 {
     return(CombineFullName(entity.FirstName, entity.LastName, entity.Nickname));
 }