Guest User

Untitled

a guest
Apr 26th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. [Authorize]
  2. public async Task<IActionResult> Index(int clientId, string error)
  3. {
  4. // ....... Removed
  5. var model = new SecretIndexModel()
  6. {
  7. Client = clients.Client,
  8. ErrorMessage = error
  9. };
  10. return View(model);
  11. }
  12.  
  13. [Authorize]
  14. [HttpPost]
  15. public async Task<IActionResult> Add(SecretIndexModel model)
  16. {
  17.  
  18. /// removed ....
  19.  
  20. return DownloadDocument("results json string");
  21. }
  22.  
  23. public FileResult DownloadDocument(string id)
  24. {
  25. var ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes("abc"));
  26.  
  27. return File(ms, System.Net.Mime.MediaTypeNames.Application.Octet, "secret.json");
  28. }
  29.  
  30. return RedirectToAction("Index",
  31. new
  32. {
  33. clientId = model.Client.Id,
  34. error = (client.Errors == null)
  35. ? string.Empty
  36. : client?.Errors?.FirstOrDefault()?.Message
  37. });
Add Comment
Please, Sign In to add comment