Beispiel #1
0
 public ActionResult CanDeleteBrick(Brick brick)
 {
     return new JsonResult()
     {
         Data = !db.Bricks.OfType<LinkableBrick>().Where(b => b.LinkedBrickId == brick.Id).Any()
     };
 }
Beispiel #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 });
        }
Beispiel #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;
 }