public void SaveUserMainTreeTransformMatrix() { using (var db = new DAL.DbContext()) { try { int id = int.Parse(this.Request.Headers.GetValues("id").First()); UserTree userTree = db.UserTrees.Find(id); userTree.TransformMatrix = this.Request.Headers.GetValues("matrix").First(); db.Entry(userTree).State = EntityState.Modified; db.SaveChanges(); }catch (Exception e) { db.Errors.Add(new Error { Message = e.Message, StackTrace = e.StackTrace, DateThrow = DateTime.Now }); db.SaveChanges(); } } }
public void SaveUserMainTree([FromBody] ClassWithTreeHtml treeClass) { int id = -1; try { using (var db = new DAL.DbContext()) { id = int.Parse(this.Request.Headers.GetValues("id").First()); UserTree userTree = db.UserTrees.Find(id); userTree.TreeHtmlCode = treeClass.TreeHtml; db.Entry(userTree).State = EntityState.Modified; db.SaveChanges(); } }catch (Exception e) { DAL.DbContext db = new DAL.DbContext(); db.Errors.Add(new Error { DateThrow = DateTime.Now, Message = "Błąd przy zapisie drzewa o ID:" + id + "/ SaveUSerMainTree() HtmlBuilderControllerAPI - " + e.Message, StackTrace = e.StackTrace }); db.SaveChanges(); } }