public IHttpActionResult GetSingle(int id) { ValidateModel(); try { CountryDimension countryDimension = (CountryDimension)_dimensionBLL.GetCountryDimension(id); if (countryDimension != null && countryDimension.ID != 0) { return(Ok(countryDimension)); } else { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent); response.Content = new StringContent("No Content"); return(ResponseMessage(response)); } } catch (Exception ex) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.InternalServerError); response.Content = new StringContent("Unknown Error"); // Insert Logging here Console.WriteLine(ex); return(ResponseMessage(response)); } }
public IHttpActionResult CreateAccount([FromBody] CountryDimension country) { ValidateModel(); try { _dimensionBLL.CreateCountryDimension(country.GetDTO()); HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent("Success"); return(ResponseMessage(response)); } catch (Exception ex) { // Insert Logging here Console.WriteLine(ex); HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.InternalServerError); response.Content = new StringContent("Unknown Error"); return(ResponseMessage(response)); } }