public ItemImage Save(ItemRequestImageInput image) { var id = Guid.NewGuid(); var virtualPath = string.Format("request/{0}_{1}.jpg", id, "{0}"); var sproc = new GoodsSaveItemRequestImage() { Identifier = id, ContentType = image.ContentType, FileName = image.FileName, FileSize = image.FileSize, ItemRequestIdentifier = image.ItemRequestIdentifier, UserIdentifier = image.UserIdentifier, Path = string.Format("/user/{0}", virtualPath), }; var storedImage = sproc.CallObject <ItemRequestImageInput>(); var container = new BinaryContainer("user"); container.Save(string.Format(virtualPath, OriginalName), image.Contents, image.ContentType); var thumbnail = this.Thumbnail(image.Contents, ImageFormat.Jpeg); var thumbnailPath = string.Format(virtualPath, ImageCore.ThumbnailName); container.Save(thumbnailPath, thumbnail, contentType); var large = this.Large(image.Contents, ImageFormat.Jpeg); var largePath = string.Format(virtualPath, ImageCore.LargeName); container.Save(largePath, large, contentType); var activity = new ActivityCore(); activity.NewItemRequestImage(storedImage); return(new ItemImage() { VirtualPathFormat = string.Format("/user/{0}", thumbnailPath), }); }