public IActionResult GetByDateRange(string range)
        {
            if (String.IsNullOrEmpty(range))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            try
            {
                var      _range = range.Split('-');
                DateTime _start = new DateTime();
                DateTime _end   = new DateTime();
                var      _st    = DateTime.TryParse(_range[0], out _start);
                var      _ed    = DateTime.TryParse(_range[1], out _end);

                if (_st && _ed)
                {
                    return(Ok(_orderSummaryService.GetByDateRange(_start, _end)));
                }
                else
                {
                    return(BadRequest(new ArgumentException("The dates entered are not valid dates. The date range must be in the format 'yyy.MM.dd-yyy.MM.dd'").Message));
                }
            }
            catch (OrderSummaryNotFoundException e)
            {
                return(BadRequest(e.Message));
            }
        }
        public IActionResult GetByOrderDate(string date)
        {
            if (String.IsNullOrEmpty(date))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            try
            {
                DateTime _dt = new DateTime();
                if (DateTime.TryParse(date, out _dt))
                {
                    return(Ok(_orderSummaryService.GetByDate(_dt)));
                }
                else
                {
                    return(BadRequest(new ArgumentException("The date entered is not a valid date. The date must be in the format 'yyy.MM.dd'").Message));
                }
            }
            catch (OrderSummaryNotFoundException e)
            {
                return(BadRequest(e.Message));
            }
        }
示例#3
0
        public IActionResult GetByState(string state)
        {
            if (String.IsNullOrEmpty(state))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            return(_helper.GetByState(type, state));
        }
示例#4
0
        public IActionResult GetByLocationId(string location)
        {
            if (String.IsNullOrEmpty(location))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            return(_helper.GetByLocationId(location));
        }
        public IActionResult GetByOrderName(string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            try
            {
                return(Ok(_orderSummaryService.GetByOrderName(name)));
            }
            catch (OrderSummaryNotFoundException e)
            {
                return(BadRequest(e.Message));
            }
        }
示例#6
0
        public IActionResult GetByPlanet(string planet)
        {
            if (String.IsNullOrEmpty(planet))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            try
            {
                return(Ok(_locService.GetByPlanet(planet)));
            }
            catch (LocationNotFoundException e)
            {
                return(BadRequest(e.Message));
            }
        }
        public IActionResult GetByName(string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            try
            {
                return(Ok(_asmRepo.GetByName(name)));
            }
            catch (ParameterNullException e)
            {
                return(BadRequest(e.Message));
            }
        }
示例#8
0
        public IActionResult GetByStatus(string status)
        {
            if (String.IsNullOrEmpty(status))
            {
                ParameterNullException e = new ParameterNullException("The parameter cannot be null");
                return(BadRequest(e.Message));
            }

            try
            {
                return(Ok(_shipService.GetByStatus(status)));
            }
            catch (ShipmentNotFoundException e)
            {
                return(BadRequest(e.Message));
            }
        }