Exemple #1
0
        public string FreeContainers(ushort N, string hangarId, out bool success, out string exceptionString)
        {
            bool exist;
            var  hangar = DataFunctions.GetHangar(hangarId, out exist, out success, out exceptionString);

            if (!success)
            {
                return(exceptionString);
            }
            if (!exist)
            {
                return(Settings.HangarDoesNotExistMessage);
            }

            if (hangar.fullness < N)
            {
                return(Settings.NotEnoughContainersMessage);
            }
            else
            {
                DataFunctions.ModifyHangar(hangar.id, -N, out success, out exceptionString);
                if (!success)
                {
                    return(exceptionString);
                }
                return(Settings.ContainersTakenAwayMessage);
            }
        }