public HttpResponseMessage PostNotification(Notification notification) { notification = databasePlaceholder.Add(notification); string apiName = WebApiConfig.DEFAULT_ROUTE_NAME; var response = this.Request.CreateResponse<Notification>(HttpStatusCode.Created, notification); string uri = Url.Link(apiName, new { controller = "notification", id = notification.id }); response.Headers.Location = new Uri(uri); return response; }
public Notification Add(Notification notification) { if (notification == null) { throw new ArgumentNullException("notification"); } Person person = Get(notification.personid); if(null != person) { notification.id = _fakeNotificationDatabaseID++; person.notifications.Add(notification); } return notification; }