public Lanche Consultar(int id) { DaoLanche repositorio = new DaoLanche(); Lanche lanche = repositorio.Consultar(id); if (lanche == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(lanche); }
public HttpResponseMessage Incluir(Lanche lanche) { DaoLanche repositorio = new DaoLanche(); lanche.Id = repositorio.Incluir(lanche); HttpResponseMessage response = base.Request.CreateResponse(HttpStatusCode.Created, lanche); string uri = base.Url.Link("DefaultApi", new { id = lanche.Id }); response.Headers.Location = new Uri(uri); return(response); }
public void Excluir(int id) { DaoLanche repositorio = new DaoLanche(); try { repositorio.Excluir(id); } catch { throw new HttpResponseException(HttpStatusCode.NotFound); } }
public void Alterar(Lanche lanche) { DaoLanche repositorio = new DaoLanche(); try { int resposta = repositorio.Alterar(lanche); } catch { throw new HttpResponseException(HttpStatusCode.NotFound); } }
public IEnumerable <Lanche> Listar() { DaoLanche repositorio = new DaoLanche(); return(repositorio.Listar()); }