public IHttpActionResult GetAllResidences() { try { Residence r = new Residence(); List <Residence> rList = r.Read(); return(Ok(rList)); } catch (Exception e) { //return badrequest(e.message); return(Content(HttpStatusCode.BadRequest, e)); } }
public Residence getResidenceS(string ResidenceName) { SqlConnection con = null; Residence res = new Residence(); try { res = res.Read(ResidenceName); return(res); } catch (Exception ex) { writeToLog(ex); throw (ex); } finally { if (con != null) { con.Close(); } } }