예제 #1
0
        //************************************************************


        void Start()
        {
            GameObject canvas = GameObject.Find("Canvas");

            buildingEditMenu  = canvas.transform.Find("BuildingEdit").gameObject;
            highwayEditMenu   = canvas.transform.Find("HighwayEdit").gameObject;
            barrierEditMenu   = canvas.transform.Find("BarrierEdit").gameObject;
            ObjectEditMenu    = canvas.transform.Find("3DObjectEdit").gameObject;
            CameraVanEditMenu = canvas.transform.Find("CameraVanEdit").gameObject;
            buildingEdit      = buildingEditMenu.GetComponent <BuildingEdit>();
            highwayEdit       = highwayEditMenu.GetComponent <HighwayEdit>();
            barrierEdit       = barrierEditMenu.GetComponent <BarrierEdit>();
            objectEdit        = ObjectEditMenu.GetComponent <ObjectEdit>();
            cameraVanEdit     = CameraVanEditMenu.GetComponent <CameraVanEdit>();

            translateX = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_TransX").GetComponent <InputField>();
            translateY = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_TransY").GetComponent <InputField>();
            translateZ = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_TransZ").GetComponent <InputField>();

            rotateX = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_RotateX").GetComponent <InputField>();
            rotateY = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_RotateY").GetComponent <InputField>();
            rotateZ = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_RotateZ").GetComponent <InputField>();

            scaleX = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_ScaleX").GetComponent <InputField>();
            scaleY = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_ScaleY").GetComponent <InputField>();
            scaleZ = ObjectEditMenu.transform.Find("Panel").Find("TransformPart").Find("InputField_ScaleZ").GetComponent <InputField>();

            currentSelectionID  = "";
            previousSelectionID = "";
        }
        public ActionResult Edit(int id)
        {
            var service = CreateBuildingService();
            var detail  = service.GetBuildingById(id);
            var model   =
                new BuildingEdit
            {
                BuildingId   = detail.BuildingId,
                BuildingName = detail.BuildingName,
                Address      = detail.Address,
                City         = detail.City,
                State        = detail.State,
                Postal       = detail.Postal
            };

            return(View(model));
        }
예제 #3
0
        public bool UpdateBuilding(BuildingEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Buildings
                    .Single(e => e.BuildingId == model.BuildingId);
                entity.BuildingId   = model.BuildingId;
                entity.BuildingName = model.BuildingName;
                entity.Address      = model.Address;
                entity.City         = model.City;
                entity.State        = model.State;
                entity.Postal       = model.Postal;

                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Edit(int id, BuildingEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.BuildingId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }
            var service = CreateBuildingService();

            if (service.UpdateBuilding(model))
            {
                TempData["SaveResult"] = "The building was successfully updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "The building could not be updated.");
            return(View(model));
        }