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); }
public void UpdateImage(image img, List<image_type> types) { Guard.ArgumentNotNull(img, "image"); this.ImageRepository.UpdateImage(img, types); }
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") }; }