public bool Create(Schema newSchema) { this.schemas.Add(newSchema); try { this.schemas.SaveChanges(); } catch (Exception e) { // TODO: logging throw; } return true; }
public ActionResult Schemata_Create(int appId, [DataSourceRequest]DataSourceRequest request, SchemaInputModel schema) { if (this.ModelState.IsValid) { var newSchema = new Schema { AppId = appId, Content = schema.Content, Name = schema.Name }; this.schemasService.Create(newSchema); schema.Id = newSchema.Id; this.apiManager.ApiDomain = "http://localhost:6969"; this.apiManager.ApiKey = this.apps.ById(appId).FirstOrDefault().ApiKey; var result = this.apiManager.RegisterSchema(JsonConvert.SerializeObject(new { schema = JsonConvert.DeserializeObject(schema.Content) }), schema.Name); } return this.Json(new[] { schema }.ToDataSourceResult(request, this.ModelState)); }