public HttpResponseMessage UpdateSetting([FromBody] NearByMeSettingModel model, string uid) { try { LogRequest(model); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } var setting = new NearByMeSetting() { UserName = uid, Enabled = model.Enabled, NotificationOn = model.NotificationOn, NotificationTone = model.NotificationTone, ShowInfo = model.ShowInfo, ShowProfileImage = model.ShowProfileImage, IsPrivateAccount = model.IsPrivateAccount }; bool opertionResult = NearByMeManager.GetInstance().UpsertNearByMeSetting(setting); 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 GetSetting(string uid) { try { LogRequest(uid); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } NearByMeSetting setting = NearByMeManager.GetInstance().GetNearByMeSetting(uid); return(Request.CreateResponse(HttpStatusCode.OK, setting)); } 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)); } }