예제 #1
0
        public bool AddShip(int cellId, int shipTypeId, string shipType)
        {
            //Ship tempShip = new Ship();
            ShipFactory shipFactory = new ShipFactory();
            Ship        tempShip    = shipFactory.GetShip("NormalShip");

            Console.WriteLine("Atejau ideti naujaji observeri--------------------------------------------------------------------");
            ShipIDObserver observeris = new ShipIDObserver(tempShip);

            tempShip.CellId = cellId;
            tempShip.Name   = shipType;
            //tempShip.ShipTypeId = shipTypeId;
            tempShip.setState(shipTypeId);

            _context.Ships.Add(tempShip);
            _context.SaveChanges();
            return(true);
        }