Beispiel #1
0
        // Update selected stops status
        // StopDto -  nested class - properties set up  @ ajax
        //  REST API - AJAX
        // ~/Scripts/Apps/HomeIndex.js - updateStop()
        public async Task Put([FromBody] StopDto oStopDto)
        {
            var oStop = new Stop()
            {
                Key      = oStopDto.Key,
                Customer = new Customer()
                {
                    ID = oStopDto.CustomerID
                },
                CurrentStatus = await StopStatus.Instance(oStopDto.Status)
            };

            var oStopFactory = new StopFactory();

            try
            {
                await oStopFactory.Update(oStop);
            }
            catch (Exception oException)
            {
                oException.Log("Update Stop");
                this.InternalServerError();
            }

            this.Ok();
        }
Beispiel #2
0
 public StopManager(
     StopRepository stopRepository,
     MixedRepository mixedRepository,
     StopValidator stopValidator,
     StopFactory stopFactory)
 {
     _stopRepository  = stopRepository;
     _mixedRepository = mixedRepository;
     _stopValidator   = stopValidator;
     _stopFactory     = stopFactory;
 }
Beispiel #3
0
        // List of Stops
        //  REST API  - AJAX
        // ~/Scripts/Apps/HomeIndex.js - loadStops()
        public async Task <IHttpActionResult> Get([FromUri] int rid)
        {
            var oStopFactory = new StopFactory();

            List <Stop> lstStops = null;

            try
            {
                lstStops = await oStopFactory.List(rid);
            }
            catch (Exception oException)
            {
                oException.Log("Stop List");
                return(this.InternalServerError());
            }

            return(this.Ok(lstStops));
        }