public HttpResponseMessage Create(SensorModel model)
        {
            if (ModelState.IsValid)
            {
                var sensor = new Sensor()
                {
                    ApiKey = model.ApiKey,
                    Type = model.Type,
                    Name = model.Name,
                    IsActive = true
                };

                _sensorService.Create(sensor);
                return Request.CreateResponse(HttpStatusCode.OK, sensor);

            }

            return Request.CreateResponse(HttpStatusCode.BadRequest, "[ERROR]: Sensor could not be added because there was missing or invalid data provided.");
        }
        public ActionResult Manage(SensorModel model)
        {
            if (ModelState.IsValid)
            {
                var sensor = new Sensor()
                {
                    Type = model.Type,
                    Name = model.Name,
                    IsActive = true
                };

                _sensorService.Create(sensor);
                ViewBag.Message = "Sensor has been created successfully";
                return RedirectToAction("Manage");
            }

            model.Sensors = _sensorService.GetAll().ToList();
            return View(model);
        }
 public Guid Update(Sensor sensor)
 {
     _sensorRepository.Update(sensor);
     return sensor.Id;
 }
 public void Delete(Sensor sensor)
 {
     _sensorRepository.Remove(sensor);
 }
 public Guid Create(Sensor sensor)
 {
     _sensorRepository.Add(sensor);
     return sensor.Id;
 }