コード例 #1
0
        public void SaveChanges(ImageViewModel imageViewModel)
        {
            System.Drawing.Image objImage = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(imageViewModel.Filename));

            ImageSaveModel imageSaveModel = new ImageSaveModel();

            imageSaveModel.Height  = objImage.Height.ToString();
            imageSaveModel.Width   = objImage.Width.ToString();
            imageSaveModel.AltText = imageViewModel.AltText;
            imageSaveModel.Src     = imageViewModel.Filename;

            System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(imageSaveModel.GetType());
            System.Text.StringBuilder sb     = new System.Text.StringBuilder();
            System.IO.StringWriter    writer = new System.IO.StringWriter(sb);
            ser.Serialize(writer, imageSaveModel);

            this.Contents = sb.ToString();
        }
コード例 #2
0
 public ContentImage(ImageViewModel imageViewModel)
 {
     _ContentID = imageViewModel.ContentID;
     _ModuleID  = imageViewModel.ModuleID;
     Initialize();
 }