public IHttpActionResult addStage([FromBody] Stage_Data data) { if (data == null) { //Bad request code 400 return(BadRequest()); } /* * if (stageLogic.existStage(data.id)) * { * //petición correcta pero no pudo ser procesada porque ya existe el archivo code 202 * return StatusCode(HttpStatusCode.Accepted); * } */ if (stageLogic.addStage(data)) { //petición correcta y se ha creado un nuevo recurso code 201 return(StatusCode(HttpStatusCode.Created)); } else { //No se pudo crear el recurso por un error interno code 500 return(InternalServerError()); } }
public bool addStage(Stage_Data data) { using (TeConstruyeEntities1 construyeEntities = new TeConstruyeEntities1()) { Stage newStage = new Stage(); newStage.id = data.id; newStage.id_project = data.id_project; newStage.name = data.name; newStage.start_date = data.start_date; newStage.status = data.status; newStage.end_date = data.end_date; newStage.description = data.description; newStage.Project = construyeEntities.Projects.Find(data.id_project); try { construyeEntities.Stages.Add(newStage); construyeEntities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
public static void CreateMyAsset() { Stage_Data asset = ScriptableObject.CreateInstance <Stage_Data>(); AssetDatabase.CreateAsset(asset, "Assets/NewScripableObject.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }
private void Start() { //Load save game date /* if (somthing exists with stage data saved within) * { * Load stage data * gameStages = //Loaded data * } */ Stage_Data.Initialise(GameStages); Stage_Loader.InitialiseStageManager(); Stage_Loader.LoadSceneSafe("TitleScreen"); }
public IHttpActionResult updateStage([FromBody] Stage_Data data) { if (data == null) { //Bad request code 400 return(BadRequest()); } if (!stageLogic.existStage(data.id)) { //petición correcta pero no pudo ser procesada porque no existe el archivo code 404 return(NotFound()); } if (stageLogic.updateStage(data)) { //petición correcta y se ha creado un nuevo recurso code 200 ok return(Ok()); } else { //No se pudo crear el recurso por un error code 500 return(InternalServerError()); } }
public bool updateStage(Stage_Data data) { using (TeConstruyeEntities1 construyeEntities = new TeConstruyeEntities1()) { try { var stage = construyeEntities.Stages.Find(data.id); stage.id = data.id; stage.id_project = data.id_project; stage.name = data.name; stage.start_date = data.start_date; stage.status = data.status; stage.end_date = data.end_date; stage.description = data.description; stage.Project = construyeEntities.Projects.Find(data.id_project); construyeEntities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
public void OnClick() { m_myStageData = new StageData(); Stage_Data.GetStageData(m_stageNumber, m_myStageData); DetailsPanel.GetComponent <StageDisplay>().Show(m_myStageData); }