public HttpResponseMessage PutUserGpsLocation([FromBody] UserLocationModel model, string uid) { try { LogRequest(model); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } var nearByUser = new NearByUser() { UId = uid, Latitude = model.Latitude, Longitude = model.Longitude }; bool opertionResult = NearByMeManager.GetInstance().UpsertUserGpsLocation(nearByUser); if (!opertionResult) { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } return(Request.CreateResponse(HttpStatusCode.OK)); } catch (ApplicationException applicationException) { return(Request.CreateErrorResponse((HttpStatusCode)Convert.ToInt16(applicationException.Message), NeeoDictionaries.HttpStatusCodeDescriptionMapper[Convert.ToInt16(applicationException.Message)])); } catch (Exception exception) { Logger.LogManager.CurrentInstance.ErrorLogger.LogError(System.Reflection.MethodBase.GetCurrentMethod().GetType(), exception.Message, exception); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public HttpResponseMessage PostNearByUser([FromBody] UserSearchByLocationModel model) { try { LogRequest(model); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } var nearByUser = new NearByUser() { UId = model.UId, Latitude = model.Latitude, Longitude = model.Longitude, IsCurrentLocation = model.IsCurrentLocation }; List <NearByUser> nearByUsers = NearByMeManager.GetInstance().GetNearByMeUserByLocation(nearByUser); return(Request.CreateResponse(HttpStatusCode.OK, new { NearByUsers = nearByUsers })); } catch (ApplicationException applicationException) { return(Request.CreateErrorResponse((HttpStatusCode)Convert.ToInt16(applicationException.Message), NeeoDictionaries.HttpStatusCodeDescriptionMapper[Convert.ToInt16(applicationException.Message)])); } catch (Exception exception) { Logger.LogManager.CurrentInstance.ErrorLogger.LogError(System.Reflection.MethodBase.GetCurrentMethod().GetType(), exception.Message, exception); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }