Ejemplo n.º 1
0
        public static ViewClassReport ToViewModel(ClassReport model)
        {
            if (model == null)
            {
                return(null);
            }

            ViewClassReport item = new ViewClassReport();

            item.Id         = model.Id;
            item.Title      = model.Title;
            item.Content    = model.Content;
            item.UserId     = model.UserId;
            item.ClassId    = model.ClassId;
            item.IsDeleted  = model.IsDeleted;
            item.CreateTime = model.CreateTime;
            List <ViewClassFile> files = (from f in model.ClassFile select ViewClassFile.ToViewModel(f)).ToList();

            item.Images = new List <ViewClassFile>();
            item.Videos = new List <ViewClassFile>();
            foreach (var file in files)
            {
                if (file.Type == 11)
                {
                    item.Images.Add(file);
                }
                else if (file.Type == 12)
                {
                    item.Videos.Add(file);
                }
            }
            return(item);
        }
Ejemplo n.º 2
0
        public static ClassFile ToEntity(ViewClassFile model)
        {
            ClassFile item = new ClassFile();

            item.Id         = model.Id;
            item.Title      = model.Title;
            item.Url        = model.Url;
            item.Type       = model.Type;
            item.ExtendName = model.ExtendName;
            item.ReportId   = model.ReportId;
            item.IsDeleted  = model.IsDeleted;
            item.CreateTime = model.CreateTime;



            return(item);
        }
Ejemplo n.º 3
0
        public static ViewClassFile ToViewModel(ClassFile model)
        {
            if (model == null)
            {
                return(null);
            }

            ViewClassFile item = new ViewClassFile();

            item.Id         = model.Id;
            item.Title      = model.Title;
            item.Url        = model.Url;
            item.Type       = model.Type;
            item.ExtendName = model.ExtendName;
            item.ReportId   = model.ReportId;
            item.IsDeleted  = model.IsDeleted;
            item.CreateTime = model.CreateTime;



            return(item);
        }