public static Image FromRequest(AddMediaRequest request, IHttpContextAccessor httpContextAccessor) { string url = Feature.SaveImage(request.Image, httpContextAccessor, "PostImage"); return(new Image() { Discription = request.Discription, ImageUrl = url, CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, }); }
private IList <Media> GetImageMedia() { var media = new List <Media>(); var image = new Microsoft.BingAds.V12.CampaignManagement.Image(); // This example uses an image with 1.5:1 aspect ratio. // For more information about available aspect ratios and min / max dimensions, // see the Image data object reference documentation. image.Data = GetImage15x10Data(); image.Type = "Image15x10"; image.MediaType = "Image"; media.Add(image); var request = new AddMediaRequest { Media = media }; return(media); }
private async Task <long> AddImageAsync(AuthorizationData authorizationData) { var media = new List <Media>(); var image = new Image(); // This example uses an image with 1.5:1 aspect ratio. // For more information about available aspect ratios and min / max dimensions, // see the Image data object reference documentation on MSDN. image.Data = GetImage15x10Data(); image.Type = "Image15x10"; image.MediaType = "Image"; media.Add(image); var request = new AddMediaRequest { Media = media }; var Service = new ServiceClient <ICampaignManagementService>(authorizationData); return((await Service.CallAsync((s, r) => s.AddMediaAsync(r), request)).MediaIds[0]); }
private async Task<long> AddImageAsync(AuthorizationData authorizationData) { var media = new List<Media>(); var image = new Image(); // This example uses an image with 1.5:1 aspect ratio. // For more information about available aspect ratios and min / max dimensions, // see the Image data object reference documentation on MSDN. image.Data = GetImage15x10Data(); image.Type = "Image15x10"; image.MediaType = "Image"; media.Add(image); var request = new AddMediaRequest { Media = media }; var Service = new ServiceClient<ICampaignManagementService>(authorizationData); return (await Service.CallAsync((s, r) => s.AddMediaAsync(r), request)).MediaIds[0]; }
public AddMediaCommand(AddMediaRequest request, IFormFileCollection files) { File = files[0]; }