public IHttpActionResult DeleteLocation(int id) { // delete this from redis, if it existed redis.delete(string.Format("loc_{0}", id)); // query the db to remove the location API_Response_Object response = new API_Response_Object(conn.RemoveLocation(id)); // return the result return(Ok(response)); }
/// <summary> /// POST /api/locations /// </summary> /// <param name="location">a location that was newly added</param> /// <returns>JSON of the added location</returns> public IHttpActionResult PostLocation(Location location) { // attempt to add this location to the database // hold the result bool was_successful = conn.AddLocation(location); // check to see if this was successful before // adding an entry into redis redis.set(string.Format("loc_{0}", location.Id), JsonConvert.SerializeObject(location), 60); // query the db to add the new location API_Response_Object response = new API_Response_Object(was_successful); // return the result return(Ok(response)); }