コード例 #1
0
        private void DoUpdate(Itinerary itinerary, UpdatedEcaItineraryStop updatedStop, ItineraryStop itineraryStop)
        {
            var validationEntity = GetEcaItineraryStopValidationEntity(itinerary: itinerary, ecaitineraryStop: updatedStop);

            itineraryStopValidator.ValidateUpdate(validationEntity);

            itineraryStop.DateArrive    = updatedStop.ArrivalDate;
            itineraryStop.DateLeave     = updatedStop.DepartureDate;
            itineraryStop.DestinationId = updatedStop.DestinationLocationId;
            itineraryStop.Name          = updatedStop.Name;
            itineraryStop.TimezoneId    = updatedStop.TimezoneId;

            Contract.Assert(updatedStop.Audit.GetType() == typeof(Update), "The audit type must be an update.  The itinerary create date should not change.");
            updatedStop.Audit.SetHistory(itineraryStop);
            updatedStop.Audit.SetHistory(itinerary);
        }
コード例 #2
0
        /// <summary>
        /// Updates the system's itinerary stop with the given updated stop.
        /// </summary>
        /// <param name="updatedStop">The updated itinerary stop.</param>
        public async Task UpdateAsync(UpdatedEcaItineraryStop updatedStop)
        {
            var itineraryStopToUpdate = await CreateGetItineraryStopByIdQuery(updatedStop.ItineraryStopId).FirstOrDefaultAsync();

            throwIfModelDoesNotExist(updatedStop.ItineraryStopId, itineraryStopToUpdate, typeof(ItineraryStop));

            var itinerary = itineraryStopToUpdate.Itinerary;

            throwSecurityViolationIfDifferentProject(updatedStop.Audit.User.Id, itinerary, updatedStop.ProjectId);

            var destination = await Context.Locations.FindAsync(updatedStop.DestinationLocationId);

            throwIfModelDoesNotExist(updatedStop.DestinationLocationId, destination, typeof(Location));

            DoUpdate(itinerary, updatedStop, itineraryStopToUpdate);
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="updatedStop"></param>
 /// <returns></returns>
 public Task UpdateAsync(UpdatedEcaItineraryStop updatedStop)
 {
     Contract.Requires(updatedStop != null, "The updated stop must not be null.");
     return(Task.FromResult <object>(null));
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="updatedStop"></param>
 public void Update(UpdatedEcaItineraryStop updatedStop)
 {
     Contract.Requires(updatedStop != null, "The updated stop must not be null.");
 }