示例#1
0
 public image AddImage(string path, int width, int height, List<image_type> types)
 {
     if (string.IsNullOrEmpty(path))
         return null;
     image img = new image
     {
         path = path,
         valid = false,
         width = width,
         height = height
     };
     return this.ImageRepository.AddImage(img, types);
 }
示例#2
0
 public void UpdateImage(image img, List<image_type> types)
 {
     Guard.ArgumentNotNull(img, "image");
     this.ImageRepository.UpdateImage(img, types);
 }
示例#3
0
 public static ImageModel FromImage(image img)
 {
     return new ImageModel
     {
         ImageId = img.image_id,
         ImageBackgroundPath = String.Format("url('{0}')", "../Content/UploadImage/" + img.path.Replace('\\', '/').TrimEnd()),
         ImagePath = img.path,
         UploadTime = img.upload_date,
         Title = img.title,
         Description = img.description,
         Width = img.width.GetValueOrDefault(),
         Height = img.height.GetValueOrDefault(),
         ImagePathThum = img.path.Replace(".jpg", "_thum.jpg")
     };
 }