Beispiel #1
0
        public async Task <CrispyApplication> CreateAsync([NotNull] CrispyApplicationCreationContext context)
        {
            if (await Query().AnyAsync(x => x.Name == context.Name))
            {
                throw new ArgumentException($"应用 {context.Name} 已存在");
            }

            var application = new CrispyApplication(context.Name);

            Store.Applications.Add(application);
            Store.Environments.Add(new CrispyEnvironment(application.Id, "基础环境"));

            await SaveChangesAsync();

            return(application);
        }
Beispiel #2
0
        public async Task <IActionResult> CreateAsync([NotNull, FromBody] CrispyApplicationCreationContext context)
        {
            await ApplicationService.CreateAsync(context);

            return(Ok());
        }