//
 // GET: /Meter/Create
 public ActionResult CreateElec(int propertyId)
 {
     try
     {
         ElectricityMeterViewModel model = new ElectricityMeterViewModel();
         model.StartDate = DateTime.Now;
         model.BelongsToProperty = propertyId;
         return View(model);
     }
     catch
     {
         return View("Error");
     }
 }
        public ActionResult CreateElec(ElectricityMeterViewModel model)
        {
            try
            {
                int propertyId = model.BelongsToProperty;

                ///submit creation and check for success
                EMResponse response = JsonConvert.DeserializeObject<EMResponse>( emAPI.createElectricityMeter(model.Meter.SerialNo, model.Meter.ScalingFactor,
                                                                                    model.Meter.NumbDigits, model.StartDate.ToString(), propertyId));

                if (response.status == EMResponse.OK)
                {
                    return RedirectToAction("Home", "Property", new { id = propertyId });
                }
                else
                {
                    return View("Error");
                }
            }
            catch
            {
                return View();
            }
        }