// 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(); }
public StopManager( StopRepository stopRepository, MixedRepository mixedRepository, StopValidator stopValidator, StopFactory stopFactory) { _stopRepository = stopRepository; _mixedRepository = mixedRepository; _stopValidator = stopValidator; _stopFactory = stopFactory; }
// 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)); }