public async Task <IActionResult> Edit(long?id, [FromBody] EditInputModel model)
        {
            //データの入力チェック
            if (!ModelState.IsValid || !id.HasValue)
            {
                return(JsonBadRequest("Invalid inputs."));
            }
            //データの存在チェック
            var preprocessing = await preprocessRepository.GetByIdAsync(id.Value);

            if (preprocessing == null)
            {
                return(JsonNotFound($"Preprocessing ID {id.Value} is not found."));
            }

            if (model.Name != null)
            {
                if (string.IsNullOrWhiteSpace(model.Name))
                {
                    //名前に空文字は許可しない
                    return(JsonBadRequest($"A name of Preprocessing is NOT allowed to set empty string."));
                }
                preprocessing.Name = model.Name;
            }
            preprocessing.Memo   = EditColumn(model.Memo, preprocessing.Memo);
            preprocessing.Cpu    = EditColumn(model.Cpu, preprocessing.Cpu);
            preprocessing.Memory = EditColumn(model.Memory, preprocessing.Memory);
            preprocessing.Gpu    = EditColumn(model.Gpu, preprocessing.Gpu);

            unitOfWork.Commit();

            return(JsonOK(new IndexOutputModel(preprocessing)));
        }
        public async Task <IActionResult> Edit(long?id, [FromBody] EditInputModel model)
        {
            // データの入力チェック
            if (!ModelState.IsValid || !id.HasValue)
            {
                return(JsonBadRequest("Invalid inputs."));
            }
            // データの存在チェック
            var preprocessing = await preprocessRepository.GetByIdAsync(id.Value);

            if (preprocessing == null)
            {
                return(JsonNotFound($"Preprocessing ID {id.Value} is not found."));
            }

            if (model.Name != null)
            {
                if (string.IsNullOrWhiteSpace(model.Name))
                {
                    // 名前に空文字は許可しない
                    return(JsonBadRequest($"A name of Preprocessing is NOT allowed to set empty string."));
                }
                preprocessing.Name = model.Name;
            }
            preprocessing.Memo   = EditColumn(model.Memo, preprocessing.Memo);
            preprocessing.Cpu    = EditColumn(model.Cpu, preprocessing.Cpu);
            preprocessing.Memory = EditColumn(model.Memory, preprocessing.Memory);
            preprocessing.Gpu    = EditColumn(model.Gpu, preprocessing.Gpu);

            // 各リソースの超過チェック
            // 変更がない場合、変更内容モデルの項目にはnullが設定されているので、DB設定値を用いてここでチェックをする。
            Tenant tenant       = tenantRepository.Get(CurrentUserInfo.SelectedTenant.Id);
            string errorMessage = clusterManagementLogic.CheckQuota(tenant, preprocessing.Cpu, preprocessing.Memory, preprocessing.Gpu);

            if (errorMessage != null)
            {
                return(JsonBadRequest(errorMessage));
            }

            unitOfWork.Commit();

            return(JsonOK(new IndexOutputModel(preprocessing)));
        }