public HttpResponseMessage Post(JournalEntryModel journal) { var userName = this.userNameProjection.GetUserName(this.Request); if (userName == null) { return(this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "No user name supplied")); } this.addCommand.AddJournalEntry(journal, userName); return(this.Request.CreateResponse()); }
public HttpResponseMessage Post(JournalEntryModel journalEntry) { var connStr = ConfigurationManager.ConnectionStrings["running-journal"].ConnectionString; var db = Database.OpenConnection(connStr); var user = db.User.Insert(UserName: "******"); db.JournalEntry.Insert( UserId: user.UserId, Time: journalEntry.Time, Distance: journalEntry.Distance, Duration: journalEntry.Duration); return Request.CreateResponse(); }
public HttpResponseMessage Post(JournalEntryModel journalEntry) { var connStr = ConfigurationManager.ConnectionStrings["running-journal"].ConnectionString; var db = Database.OpenConnection(connStr); var userId = db.User.Insert(UserName: "******").UserId; db.JournalEntry.Insert(UserId: userId, Time: journalEntry.Time, Distance: journalEntry.Distance, Duration: journalEntry.Duration); return(Request.CreateResponse()); }
public HttpResponseMessage Post(JournalEntryModel journalEntry) { entries.Add(journalEntry); return(this.Request.CreateResponse()); }