예제 #1
0
        public ActionResult UpdateLocations(SetRequest rq)
        {
            if (rq == null)
            {
                throw new ArgumentNullException("rq");
            }
            if (!rq.ParentId.HasValue)
            {
                throw new ArgumentException("Request should have parentId");
            }
            long pid = rq.ParentId.Value;

            if (pid <= 0)
            {
                throw new ArgumentException("parentId should be positive");
            }
            if (rq.Edits != null)
            {
                foreach (var e in rq.ToPoco <LocationBaseDeviceMapping>())
                {
                    var data = new DeviceLocationMap {
                        DeviceId = pid, LocationBaseId = e.LocationBaseId, Mapping = e.Mapping
                    };
                    GeneralPersistense.Upsert(data);
                }
            }
            return(ListLocations(pid));
        }
예제 #2
0
 public ActionResult Set(SetRequest rq)
 {
     if (rq == null)
     {
         throw new ArgumentNullException("rq");
     }
     rq.Persist <LocationBase>(LocationBase.Delete);
     return(Json(SetRequest.FromPoco(LocationPersistence.ListBases()), JsonRequestBehavior.AllowGet));
 }
예제 #3
0
        //
        // GET: /Location/

        public ActionResult Index()
        {
            return(View("~/Views/LocationBases.cshtml", SetRequest.FromPoco(LocationPersistence.ListBases())));
        }
예제 #4
0
 public ActionResult ListLocations(long id)
 {
     return(Json(SetRequest.FromPoco(DevicePersistense.GetLocations(id)), JsonRequestBehavior.AllowGet));
 }
예제 #5
0
        //
        // GET: /Device/


        public ActionResult Index()
        {
            return(View("~/Views/Devices.cshtml", SetRequest.FromPoco(DevicePersistense.List())));
        }