Example #1
0
 public JsonResult Delete(GraphicObject aaa)
 {
     string uid = User.Identity.GetUserId();
     var objs = new List<GraphicObject>();
     using (var db = new ObjectDatabase())
     {
         var z = db.Permissions.SingleOrDefault(m => (m.BoardId == aaa.BoardId && m.UserId == uid && m.DeleteObject == true));
         if (z != null)
         {
             var obj = db.GraphicObjects.SingleOrDefault(m => m.GraphicObjectId == aaa.GraphicObjectId);
             if (obj != null)
             {
                 db.GraphicObjects.Remove(obj);
                 db.SaveChanges();
             }
         }
         var x = db.GraphicObjects.Where(m => m.BoardId == aaa.BoardId);
         objs.AddRange(x.ToArray());
     }
     return Json(objs);
 }
Example #2
0
 public JsonResult Update(GraphicObject aaa)
 {
     string uid = User.Identity.GetUserId();
     var objs = new List<GraphicObject>();
     using (var db = new ObjectDatabase())
     {
         var z = db.Permissions.SingleOrDefault(m => (m.BoardId == aaa.BoardId && m.UserId == uid && m.EditObject == true));
         if (z != null)
         {
             var obj = db.GraphicObjects.SingleOrDefault(m => m.GraphicObjectId == aaa.GraphicObjectId);
             if (obj != null)
             {
                 obj.x = aaa.x;
                 obj.y = aaa.y;
                 obj.fill = aaa.fill;
                 obj.stroke = aaa.stroke;
                 obj.stroke_width = aaa.stroke_width;
                 obj.width = aaa.width;
                 obj.height = aaa.height;
                 db.SaveChanges();
             }
         }
         var x = db.GraphicObjects.Where(m => m.BoardId == aaa.BoardId);
         objs.AddRange(x.ToArray());
     }
     return Json(objs);
 }
Example #3
0
 public JsonResult Refresh(GraphicObject aaa)
 {
     var objs = new List<GraphicObject>();
     using (var db = new ObjectDatabase())
     {
         var x = db.GraphicObjects.Where(m => m.BoardId == aaa.BoardId);
         objs.AddRange(x.ToArray());
     }
     return Json(objs);
 }