public async Task <CrispyEnvironment> AddAsync([NotNull] CrispyEnvironmentAddtionContext context) { if (await Query().AnyAsync(x => x.ApplicatoinId == context.ApplicationId && x.Name == context.Name)) { throw new ArgumentException($"环境 {context.Name} 已存在"); } var environment = new CrispyEnvironment(context.ApplicationId, context.Name, CrispyEnviromentType.Extension); Store.Environments.Add(environment); await SaveChangesAsync(); return(environment); }
public async Task <IActionResult> AddAsync([NotNull, FromBody] CrispyEnvironmentAddtionContext context) { await EnviromentService.AddAsync(context); return(Ok()); }