Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. [HttpPost]
  2. public AttachmentDto CreateAttachment(JObject json)
  3. {
  4. using (var _client = new DataServiceClient("epData"))
  5. {
  6. if (Properties.Settings.Default.Domain != "")
  7. {
  8. _client.ClientCredentials.Windows.ClientCredential.UserName = Properties.Settings.Default.Domain + "\" + Properties.Settings.Default.Login;
  9. _client.ClientCredentials.Windows.ClientCredential.Password = Properties.Settings.Default.Password;
  10. }
  11. var userId = json["userId"].ToObject<Guid>();
  12. _client.SetCurrentUser(userId);
  13.  
  14.  
  15. var filePath = json["filePath"].ToObject<string>();
  16.  
  17. var originalFilePath = Convert.FromBase64String(filePath);
  18. var fileName = json["fileName"].ToObject<string>();
  19. var categoryId = json["categoryId"].ToObject<Guid>();
  20.  
  21. var result = _client.CreateAttachment(fileName, categoryId, data);
  22. return null;
  23. }
  24. }
  25.  
  26. $scope.uploaderImages = new FileUploader({
  27. url: 'http://newsimageupload/' + newsService.editNews.id,
  28. removeAfterUpload: true
  29. });
  30.  
  31. $scope.uploaderImages.uploadAll();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement