public HttpResponseMessage AddGoogleValue([FromBody] googleValueDto value) { try { if (value != null) { return(Request.CreateResponse(HttpStatusCode.OK, GoogleValueService.AddGoogleValue(value.value))); } return(Request.CreateResponse(HttpStatusCode.BadRequest, "there is no value in the body")); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "There was an InternalServerError: " + e)); } }
public HttpResponseMessage DeleteGoogleValue(string id) { try { bool is_deleted; is_deleted = GoogleValueService.deleteGoogleValue(id); if (!is_deleted) { return(Request.CreateResponse(HttpStatusCode.NotFound, "There is not google value with id - " + id)); } return(Request.CreateResponse(HttpStatusCode.OK, "the object had been deleted ")); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "There was an InternalServerError: " + e)); } }
public HttpResponseMessage GetGoogleValue(string id) { try { googleValueDto db_value; db_value = GoogleValueService.GetGoogleValueByid(id); if (db_value == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "There is not google value with id - " + id)); } return(Request.CreateResponse(HttpStatusCode.OK, db_value)); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "There was an InternalServerError: " + e)); } }
public HttpResponseMessage GetAllGoogleValue(bool test = false) { GoogleValueService google_value_service = new GoogleValueService(); try { List <googleValueDto> list = google_value_service.GetAllGoogleValue(); if (list.Count == 0 || test) { return(Request.CreateResponse(HttpStatusCode.NotFound, "There is no google value in the db")); } return(Request.CreateResponse(HttpStatusCode.OK, list)); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "There was an InternalServerError: " + e)); } }