예제 #1
0
        public IActionResult Create([FromBody] CreateInputModel model)
        {
            //データの入力チェック
            if (!ModelState.IsValid)
            {
                return(JsonBadRequest("Invalid inputs."));
            }

            Storage storage = new Storage()
            {
                Name          = model.Name,
                ServerAddress = model.ServerUrl,
                AccessKey     = model.AccessKey,
                SecretKey     = model.SecretKey,
                NfsServer     = model.NfsServer,
                NfsRoot       = model.NfsRoot
            };

            tenantRepository.AddStorage(storage);
            unitOfWork.Commit();
            tenantRepository.Refresh();

            var result = new IndexOutputModel(storage);

            return(JsonOK(result));
        }