Advertisement
Guest User

Untitled

a guest
Nov 12th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement