Example #1
0
File: Grid.cs Project: h4k/asp-test
 public bool CreateGrid(Grid instance)
 {
     if (instance.id == 0)
     {
         Db.Grids.Add(instance);
         Db.SaveChanges();
         return true;
     }
     return false;
 }
Example #2
0
File: Grid.cs Project: h4k/asp-test
 public bool UpdateGrid(Grid instance)
 {
     var cache = Db.Grids.FirstOrDefault(o => o.id == instance.id);
     if (cache != null)
     {
         Db.Entry(cache).CurrentValues.SetValues(instance);
         Db.SaveChanges();
         return true;
     }
     return false;
 }