Exemple #1
0
        public IHttpActionResult GetEnergyLevel(long id)
        {
            var b = esvc.GetEnergyLevel(id);

            if (b == null)
            {
                return(NotFound());
            }
            return(Ok(EnergyLevelDto.FromEnergyLevel(b)));
        }
Exemple #2
0
        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)));
        }
Exemple #3
0
 // GET: api/EnergyLevels?userId=xjlh2b
 public IEnumerable <EnergyLevelDto> GetEnergyLevels(String userId)
 {
     return(esvc.GetEnergyLevels(userId).Select(b => EnergyLevelDto.FromEnergyLevel(b)));
 }
Exemple #4
0
 // GET: api/EnergyLevels
 public IEnumerable <EnergyLevelDto> GetEnergyLevels()
 {
     return(esvc.GetEnergyLevels().Select(b => EnergyLevelDto.FromEnergyLevel(b)));
 }