예제 #1
0
 public ActionResult PostMachineEvent(MachineEvent machineEvent)
 {
     try
     {
         if (ModelState.IsValid)
         {
             try
             {
                 context db = new context();
                 db.machineEvents.Add(machineEvent);
                 db.SaveChanges();
                 return(Json(1));
             }
             catch (Exception ex)
             {
                 return(Json(0));
             }
         }
         else
         {
             return(Json(0));
         }
     }
     catch (Exception ex)
     {
         logger.Warn(ex.Message);
         return(Json(ex.Message));
     }
 }
예제 #2
0
        public ActionResult Index()
        {
            MachineEvent _event = new MachineEvent();

            _event.MachineID = 94200;
            _event.numberOfBeatsSinceLastChange = 100;
            _event.systemState           = 1;
            _event.timeOfEvent           = DateTime.Now;
            _event.timeOfLastStateChange = DateTime.Now;


            return(Json(_event, JsonRequestBehavior.AllowGet));
        }