public async Task Process([FromBody] FileLoadViewModel model) { using (var http = new HttpClient()) { http.BaseAddress = new Uri("http://localhost:55233/"); await http.PostAsync("/api/file", new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json")); } }
public async Task <IHttpActionResult> Post(FileLoadViewModel model) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (string.IsNullOrWhiteSpace(model.DocumentName)) { return(BadRequest("Document full name is not in correct format")); } var extension = Path.GetExtension(model.DocumentName).Replace(".", ""); if (string.IsNullOrWhiteSpace(extension)) { return(BadRequest("Extension is not in correct format")); } var fileBytes = await _blobStorage.LoadDocumentFromSystemAsync(model.Client, model.DocumentName); var command = new FileLoadRequestCommand { Client = model.Client, FileName = model.DocumentName, Content = fileBytes }; _manager.SendFileLoadRequestCommand(command); return(Ok()); } catch (Exception ex) { return(InternalServerError(ex)); } }