示例#1
0
        public IActionResult Get([FromQuery] string number)
        {
            var result = packstationsStorageInst.GetPackstation(number);

            if (result == null)
            {
                return(BadRequest("Постамат не найден"));
            }

            return(Ok(result));
        }
        public override bool IsValid(object value)
        {
            Packstation packstation = value as Packstation;

            if (packstation == null)
            {
                return(false);
            }

            PackstationsStorage packstationsStorageInst = PackstationsStorage.GetInstance();

            var foundPackstation = packstationsStorageInst.GetPackstation(packstation.Number);

            if (foundPackstation != null && foundPackstation.IsOpen)
            {
                return(true);
            }

            return(false);
        }