예제 #1
0
 private void Awake()
 {
     if (inst == null)
     {
         inst = this;
     }
 }
예제 #2
0
        public IActionResult PostStage([FromBody] StagesModel Model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!_stageRepository.CreateStages(Model))
            {
                ModelState.AddModelError("", $"Something went wrong saving the job " +
                                         $"{Model.Name}");
                return(StatusCode(500, ModelState));
            }

            return(Ok(new { Stage = Model.Name, stageCreated = true }));
        }
예제 #3
0
        public IActionResult PutStage([FromRoute] int id, [FromBody] StagesModel Model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != Model.Id)
            {
                return(BadRequest());
            }

            if (!_stageRepository.UpdateStages(Model))
            {
                ModelState.AddModelError("", $"Something went wrong updating the Product " +
                                         $"{Model.Name}");
                return(StatusCode(500, ModelState));
            }

            return(NoContent());
        }