Пример #1
0
        public IHttpActionResult GetWarningIndicator(string id)
        {
            List <WarningIndicator> warningIndicator = db.WarningIndicators.Where(i => i.Cust_Id == id).ToList();

            if (warningIndicator == null || warningIndicator.Count() <= 0)
            {
                return(NotFound());
            }

            Customer customer = db.Customers.Where(i => i.Cust_id == id).FirstOrDefault();
            WarningIndicatorDecorator warningIndicatorDecorator = new WarningIndicatorDecorator(warningIndicator, customer);

            return(Ok(warningIndicatorDecorator));
        }
Пример #2
0
        public IHttpActionResult GetWarningIndicatorsByDate(string id, string fromDate, string toDate)
        {
            // DateTime dtFrom = Convert.ToDateTime(fromDate,"DD-MMM-YYYY");
            DateTime dtFrom = Convert.ToDateTime(DateTime.ParseExact(fromDate, "dd-MM-yyyy", CultureInfo.InvariantCulture));
            DateTime dtTo   = Convert.ToDateTime(DateTime.ParseExact(toDate, "dd-MM-yyyy", CultureInfo.InvariantCulture));

            List <WarningIndicator> warningIndicator = db.WarningIndicators.Where(i => i.Cust_Id == id && (i.observedOn >= dtFrom && i.observedOn <= dtTo)).ToList();

            if (warningIndicator == null || warningIndicator.Count() <= 0)
            {
                return(NotFound());
            }

            Customer customer = db.Customers.Where(i => i.Cust_id == id).FirstOrDefault();
            WarningIndicatorDecorator warningIndicatorDecorator = new WarningIndicatorDecorator(warningIndicator, customer);

            return(Ok(warningIndicatorDecorator));
        }