コード例 #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())));
        }