示例#1
0
        public static ViewClass ToViewModel(Class model)
        {
            if (model == null)
            {
                return(null);
            }

            ViewClass item = new ViewClass();


            item.Id            = model.Id;
            item.YogaTypeID    = model.YogaTypeID;
            item.Summary       = model.Summary;
            item.Content       = model.Content;
            item.Banner        = model.Banner;
            item.Start         = model.Start;
            item.Duration      = model.Duration;
            item.DurationUnit  = model.DurationUnit;
            item.AreaID        = model.AreaID;
            item.Address       = model.Address;
            item.Price         = model.Price;
            item.Discount      = model.Discount;
            item.IsItem        = model.IsItem;
            item.ItemClassID   = model.ItemClassID;
            item.Max           = model.Max;
            item.ClassType     = model.ClassType;
            item.ClassStatus   = model.ClassStatus;
            item.NoPassMsg     = model.NoPassMsg;
            item.UserId        = model.UserId;
            item.UpdateTime    = model.UpdateTime;
            item.IsDeleted     = model.IsDeleted;
            item.CreateTime    = model.CreateTime;
            item.Name          = model.Name;
            item.TopicIds      = model.TopicIds;
            item.Tags          = model.Tags;
            item.InterestCount = model.InterestedClass.Count;
            item.User          = ViewYogaUser.ToViewModel(model.User);
            item.ReportCount   = model.ClassReport.Count;
            item.Reports       = (from r in model.ClassReport select ViewClassReport.ToViewModel(r)).ToList();
            item.Teachers      = (from r in model.ClassTeacher select ViewClassTeacher.ToViewModel(r)).ToList();
            item.iShareNums    = model.iShareNums;
            item.iReadNums     = model.iReadNums;
            item.CloseTime     = model.CloseTime;
            item.EndTime       = model.EndTime;
            item.MessageDes    = model.MessageDes;
            item.CenterID      = model.CenterID;
            return(item);
        }
示例#2
0
        public static Class ToEntity(ViewClass model)
        {
            Class item = new Class();

            item.Id           = model.Id;
            item.YogaTypeID   = model.YogaTypeID;
            item.Summary      = model.Summary;
            item.Content      = model.Content;
            item.Banner       = model.Banner;
            item.Start        = model.Start;
            item.Duration     = model.Duration;
            item.DurationUnit = model.DurationUnit;
            item.AreaID       = model.AreaID;
            item.Address      = model.Address;
            item.Price        = model.Price;
            item.Discount     = model.Discount;
            item.IsItem       = model.IsItem;
            item.ItemClassID  = model.ItemClassID;
            item.Max          = model.Max;
            item.ClassType    = model.ClassType;
            item.ClassStatus  = model.ClassStatus;
            item.NoPassMsg    = model.NoPassMsg;
            item.UserId       = model.UserId;
            item.UpdateTime   = model.UpdateTime;
            item.IsDeleted    = model.IsDeleted;
            item.CreateTime   = model.CreateTime;
            item.Name         = model.Name;
            item.TopicIds     = model.TopicIds;
            item.Tags         = model.Tags;
            item.iReadNums    = model.iReadNums;
            item.iShareNums   = model.iShareNums;
            item.CloseTime    = model.CloseTime;
            item.EndTime      = model.EndTime;
            item.MessageDes   = model.MessageDes;
            item.CenterID     = model.CenterID;
            return(item);
        }