public IHttpActionResult Get(int id) { try { Jam jam; var jamRepository = new JamRepository(); if (id > 0) { var jams = jamRepository.Retrieve(); jam = jams.FirstOrDefault(p => p.JamId == id); if (jam == null) { return(NotFound()); } } else { jam = jamRepository.Create(); } return(Ok(jam)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Get() { try { var jamRepository = new JamRepository(); return(Ok(jamRepository.Retrieve().AsQueryable())); } catch (Exception ex) { return(InternalServerError(ex)); } }