public IHttpActionResult GetEnergyLevel(long id) { var b = esvc.GetEnergyLevel(id); if (b == null) { return(NotFound()); } return(Ok(EnergyLevelDto.FromEnergyLevel(b))); }
public IHttpActionResult PostEnergyLevel(EnergyLevel el) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } esvc.CreateEnergyLevel(el); uow.Save(); return(CreatedAtRoute("DefaultApi", new { id = el.ID }, EnergyLevelDto.FromEnergyLevel(el))); }
// GET: api/EnergyLevels?userId=xjlh2b public IEnumerable <EnergyLevelDto> GetEnergyLevels(String userId) { return(esvc.GetEnergyLevels(userId).Select(b => EnergyLevelDto.FromEnergyLevel(b))); }
// GET: api/EnergyLevels public IEnumerable <EnergyLevelDto> GetEnergyLevels() { return(esvc.GetEnergyLevels().Select(b => EnergyLevelDto.FromEnergyLevel(b))); }