public List <WandModel> Get() { try { List <Wand> wands = _wandRepository.Get(); List <WandModel> wandModels = new List <WandModel>(); foreach (Wand wand in wands) { WandModel wandModel = new WandModel(); wandModel.Id = wand.Id; wandModel.CoreMaterial = wand.CoreMaterial?.Identifier; wandModel.WoodMaterial = wand.WoodMaterial?.Identifier; wandModel.Length = wand.Length; wandModel.Wizzard = wand.Wizzard?.Name; wandModels.Add(wandModel); } return(wandModels); } catch { return(null); } }
void Update() { if (!navigator.doNav && Input.GetKeyDown(KeyCode.Alpha6) && keyboardControls) { UpdateWandModels(); } //Wand select if (Input.GetKeyDown(KeyCode.Alpha1) && keyboardControls) { simulatorActiveWand = Wand.Left; startTime = Time.time; } if (Input.GetKeyDown(KeyCode.Alpha2) && keyboardControls) { simulatorActiveWand = Wand.Right; startTime = Time.time; } simActiveWand = simulatorActiveWand; //Gravity if (applyGravity) { //SimpleMove applies gravity automatically charController.SimpleMove(Vector3.zero); } // Show and hide the CyberCANOE's screen. if (Input.GetKeyDown(KeyCode.Alpha6) && keyboardControls) { changeScreens(); startTime = Time.time; } //Change wand models if (Input.GetKeyDown(KeyCode.Alpha5) && keyboardControls && !navigator.doNav) { wandModel++; wandModel = (WandModel)((int)wandModel % 3); UpdateWandModels(); startTime = Time.time; } //Show and hide Simulator Mode help screen. if (Input.GetKeyDown(KeyCode.Slash) && keyboardControls) { CC_GUI.SetActive(!CC_GUI.activeInHierarchy); } // Press the escape key to quit application if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } keyboardControls = kbcont; //Call ONLY works in Update, tested in other locations and failed if (ClusterNetwork.isMasterOfCluster) { StartCoroutine(endOfFrameForMaster()); } }
public IHttpActionResult GetById(int id) { WandModel wandModel = _service.GetById(id); if (wandModel != null) { return(Json(wandModel)); } else { return(BadRequest()); } }
public IHttpActionResult Post([FromBody] WandModel wandModel) { if (wandModel.WoodMaterial != null && wandModel.CoreMaterial != null) { if (_service.Post(wandModel) == true) { return(Ok()); } else { return(BadRequest()); } } else { return(BadRequest()); } }
public WandModel GetById(int id) { try { Wand wand = _wandRepository.GetById(id); WandModel wandModel = new WandModel(); wandModel.Id = wand.Id; wandModel.CoreMaterial = wand.CoreMaterial?.Identifier; wandModel.WoodMaterial = wand.WoodMaterial?.Identifier; wandModel.Length = wand.Length; wandModel.Wizzard = wand.Wizzard.Name; return(wandModel); } catch { return(null); } }
public bool Post(WandModel wandModel) { try { Wand wand = new Wand(); wand.WoodMaterial = new Material(); wand.CoreMaterial = new Material(); wand.CoreMaterial.Identifier = wandModel.CoreMaterial; wand.WoodMaterial.Identifier = wandModel.WoodMaterial; wand.Length = wandModel.Length; _wandRepository.Insert(wand); return(true); } catch { return(false); } }