Ejemplo n.º 1
0
        public PersistenceResult AddSpaceToParking(Space space, Parking parking)
        {
            int newID = -1;

            if (space == null || parking == null)
                return new PersistenceResult() { ID = newID, State = ResultStates.Error, Message = "Space or Parking null reference" };

            try
            {
                parking.AddSpace(space);
                ParkingsStore.Update(parking);
                return new PersistenceResult() {ID =parking.Spaces.Last().ID, State= ResultStates.Completed };
            }
            catch (Exception ex)
            {
                return new PersistenceResult() { State = ResultStates.Error, Message = ex.Message };
            }
#pragma warning disable CS0162 // Unreachable code detected
            return new PersistenceResult() { ID=newID , State = ResultStates.Completed };
#pragma warning restore CS0162 // Unreachable code detected
        }