Exemplo n.º 1
0
        private static void Handle(List <Neighbor> neighbors)
        {
            foreach (var neighbor in neighbors)
            {
                if (neighborManager.GetIntersects(neighbor) != null)
                {
                    throw new IntersectException("Güncellemeye çalıştığınız mahalle, herhangi bir mahalle ile kesişmemelidir.");
                }

                var alreadyInside = doorManager.GetDoorsWithNeighborCode(neighbor.Id);
                var newInside     = doorManager.GetDoorsInNeighBor(neighbor);

                var notInside = alreadyInside.Except(newInside, new DoorComparer());


                foreach (var door in notInside)
                {
                    var intersect = neighborManager.GetIntersects(door);

                    if (intersect == null)
                    {
                        throw new OrphanDoorException("Kapıları mahallesiz bırakarak güncelleme yapamazsınız.");
                    }
                }
            }
        }
Exemplo n.º 2
0
        public JsonResult DeleteNeighbor(string neighborId)
        {
            var neighbor = _neighborManager.Get(new Neighbor {
                Id = neighborId
            });
            var doors = _doorManager.GetDoorsWithNeighborCode(neighbor.Id).Select(d => d.Id);

            _neighborManager.Delete(neighbor);

            return(Json(doors));
        }