Created
November 26, 2012 23:43
-
-
Save jonnii/4151406 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 HttpResponseMessage Post(IEnumerable<Message> messages) | |
{ | |
try | |
{ | |
Logger.Info("POST MessagesController::Create"); | |
if (messages.Any(m => !m.IsValid)) | |
{ | |
return new HttpResponseMessage(HttpStatusCode.BadRequest) | |
{ | |
ReasonPhrase = "Invalid messages" | |
}; | |
} | |
Logger.InfoFormat("Persisting {0} messages", messages.Count()); | |
persister.Persist(messages); | |
return new HttpResponseMessage(HttpStatusCode.Created); | |
} | |
catch (Exception e) | |
{ | |
Logger.FatalFormat(e, "{0}", e.Message); | |
throw; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment