public EspecieResponse LeerPorId(int id) { try { var response = new EspecieResponse(); var bc = new EspecieComponent(); response.Result = bc.Find(id); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
public EspecieResponse Agregar(EspecieRequest request) { try { var response = new EspecieResponse(); var bc = new EspecieComponent(); response.Result = bc.Add(request.Especie); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }