public async Task <LifecycleEditor> CreateOrModify(string name) { var existing = await repository.FindByName(name).ConfigureAwait(false); if (existing == null) { Instance = await repository.Create(new LifecycleResource { Name = name, }).ConfigureAwait(false); } else { existing.Name = name; Instance = await repository.Modify(existing).ConfigureAwait(false); } return(this); }
public LifecycleEditor CreateOrModify(string name) { var existing = repository.FindByName(name); if (existing == null) { Instance = repository.Create(new LifecycleResource { Name = name, }); } else { existing.Name = name; Instance = repository.Modify(existing); } return(this); }
public static Task <LifecycleResource> FindByNameOrIdOrFail(this ILifecyclesRepository repo, string nameOrId) { return(repo.FindByNameOrIdOrFail(n => repo.FindByName(n), "Lifecycles", "lifecycle", nameOrId)); }