public async Task<HttpResponseMessage> SaveEntityDefinition(EntityDefinition model) { this.ValidateServices(); // TODO validate the model await this._repository.SaveEntityDefinitionAsync(model); return new HttpResponseMessage(System.Net.HttpStatusCode.OK); }
public Task<EntityDefinition> SaveEntityDefinitionAsync(EntityDefinition model) { if (model == null) throw new ArgumentNullException("model"); var content = JsonConvert.SerializeObject(model); var path = Path.Combine(_rootFolder, model.EntityName + ".entity"); if (File.Exists(path)) File.Delete(path); File.WriteAllText(path, content); return Task.FromResult(model); }