Created
July 22, 2012 01:00
-
-
Save eulerfx/3157819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImportRequestModel | |
{ | |
public string SupplierId { get; set; } | |
public string SeedFilePath { get; set; } | |
} | |
public class ImportController : ApiController | |
{ | |
public ImportController(IBus bus) | |
{ | |
this.bus = bus; | |
} | |
readonly IBus bus; | |
public HttpResponseMessage Post(ImportRequestModel request) | |
{ | |
var taskId = Guid.NewGuid().ToString("N"); | |
this.bus.Send<ImportProducts>(message => | |
{ | |
message.TaskId = taskId; | |
message.SupplierId = request.SupplierId; | |
message.SeedFilePath = request.SeedFilePath; | |
}); | |
var response = new HttpResponseMessage(HttpStatusCode.Accepted); | |
response.Headers.Location = new Uri(string.Format("https://api.example.com/import/status/{0}", taskId)); | |
return response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment