public HttpResponseMessage Get(string userName) { var profile = new Facade().GetProfileRepository().Get(userName); ProfileDTO profileDTO = null; profileDTO = new ProfileConverter().Convert(profile); return Request.CreateResponse<ProfileDTO>(HttpStatusCode.OK, profileDTO); }
/// <summary> /// Will get a specific Profile found by the Id /// </summary> /// <param name="id"></param> /// <returns></returns> public HttpResponseMessage Get(int id) { var profile = new Facade().GetProfileRepository().Get(id); ProfileDTO profileDTO = null; if (profile != null) { profileDTO = new ProfileConverter().Convert(profile); return Request.CreateResponse<ProfileDTO>(HttpStatusCode.OK, profileDTO); } var response = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Profile not found.") }; throw new HttpResponseException(response); }