예제 #1
0
 public ActionResult CanDeleteBrick(Brick brick)
 {
     return new JsonResult()
     {
         Data = !db.Bricks.OfType<LinkableBrick>().Where(b => b.LinkedBrickId == brick.Id).Any()
     };
 }
예제 #2
0
        public ActionResult Edit(Brick brick)
        {
            // update current brick
            db.Bricks.Attach(brick);
            db.Entry(brick).State = EntityState.Modified;
            db.SaveChanges();

            // load brick's wall property to get current scene later
            db.Entry(brick).Reference(b => b.Wall).Load();

            // redirect to scene
            return RedirectToAction("Edit", "Scene", new { id = brick.Wall.SceneId });
        }
예제 #3
0
 // apply only properties that can be changed on scene designer
 private Brick ApplyCommonBrickValues(Brick brick)
 {
     var realBrick = db.Bricks.First(b => b.Id == brick.Id);
     realBrick.Order = brick.Order;
     realBrick.Width = brick.Width;
     return realBrick;
 }