public HttpResponseMessage PostEvent(EventModel json)
 {
     try
     {
         json.ID = IdentificationNumber.NewID();
         string query = "insert into dbo.Events Values('" + json.ID + "')";
         //saves the id to the lookup db
         SQLCommand.ExecuteQuery(query);
         //saves the object to the xml database
         SQLCommand.ExecuteQuerySaveObject<EventModel>("ev", json);
         return new HttpResponseMessage(HttpStatusCode.OK);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.StackTrace);
         return new HttpResponseMessage(HttpStatusCode.Conflict);
     }
 }
Exemple #2
0
 public static EventModel CreateEvent(string userID, DateTime startTime, DateTime endTime, DateTime artistPickTime, double minPrice, double maxPrice, double optimalPrice)
 {
     var c = new EventModel()
     {
         ID = IdentificationNumber.NewID(),
         OwnedByUser = new IdentificationNumber(userID),
         Entries = new List<IdentificationNumber>(),
         StartTime = startTime,
         EndTime = endTime,
         ArtistPickTime = artistPickTime,
         MinPrice = minPrice,
         MaxPrice = maxPrice,
         OptimalPrice = optimalPrice
     };
     return c;
 }