Exemple #1
0
        /// <summary>
        /// StopApiController/PUT
        /// </summary>
        /// <param name="oStop"></param>
        /// <returns></returns>
        public async Task Update(Stop oStop)
        {
            var oCurrentStatus = oStop.CurrentStatus;

            if (oCurrentStatus == null)
            {
                throw new MissingMemberException("Stop", "Status");
            }

            var oCustomerRepository = new StopRepository();

            var oCustomer = oStop.Customer;

            if (oCustomer == null)
            {
                throw new MissingMemberException("Stop", "Customer");
            }

            try //update status
            {
                await oCustomerRepository.Update(oStop.Key, oCustomer.ID, oCurrentStatus.Code);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public void Edit(StopDTO stopDTO)
        {
            var stop             = _stopRepository.Find(stopDTO.Id);
            int newStationNumber = _stopRepository.GetNextStopNumberForStopName(stopDTO.Name);

            stop = _stopFactory.FillIn(stop, stopDTO.Name, stopDTO.Latitude,
                                       stopDTO.Longitude, stopDTO.StopType, newStationNumber);
            _stopRepository.Update(stop);
        }