public PwgImageAdded addImageByMultiPartForm(FileInfo fileImage, Int32? imageId, Int32? AlbumId, String imageName, String imageAuthor, String imageComment, PwgConfidentLevelEnum? imageLevel, List<PwgTag> imageTags) { PwgImageAdded returnValue = new PwgImageAdded(); try { PwgAddSimpleImageProxyResponse response = PwgImagesProxy.pwg_images_addSimple(fileImage, imageId, AlbumId, imageName, imageAuthor, imageComment, (int) imageLevel, imageTags); if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) { if (response.Erreur != null) { throw new PwgServiceException("addImageByMultiPartForm, the server has return the error.", response.Erreur.Code, response.Erreur.Message); } else { throw new PwgServiceException("addImageByMultiPartForm : a error occurs during server process."); } } else { returnValue = ConvertProxyResponseToDTO(response); } } catch (PwgProxyException ex) { throw new PwgServiceException("addImageByMultiPartForm : a error is raised by proxy.", ex); } return returnValue; }
/// <summary> /// private: convert response to dto object /// </summary> /// <param name="response"></param> /// <param name="session"></param> internal static PwgImageAdded ConvertProxyResponseToDTO(PwgAddSimpleImageProxyResponse response) { PwgImageAdded returnValue = new PwgImageAdded(); returnValue.Id = response.Id; if (String.IsNullOrEmpty(response.UrlImage)) { returnValue.UrlElement = null; } else { returnValue.UrlElement = (new UriBuilder(response.UrlImage)).Uri; } return returnValue; }