コード例 #1
0
        public Trip CreateTrip(TripCandidate tripCandidate)
        {
            Trip newTrip;

            try
            {
                newTrip = ServiceMapper.Map <Trip>(tripCandidate);

                newTrip.Id = _tripRepo.GetNewId();

                foreach (var sessionId in tripCandidate.PhotoSessions.Select(s => s.SessionId))
                {
                    int?destinationId = null;

                    var destination =
                        tripCandidate.Destinations.FirstOrDefault(d => d.Sessions.Any(s => s.SessionId == sessionId));

                    if (destination != null)
                    {
                        destinationId = destination.Id;
                    }

                    _photoStore.ConfirmPhotoSession(sessionId, newTrip.Id, destinationId);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }


            return(newTrip);
        }
コード例 #2
0
        public static void Configure()
        {
            var config = new MvvmConfiguration();

            //base.Configure(config);

            ServiceMapper.RegisterObjects(config.IoC);

            Mapper.Initialize(
                cfg =>
            {
                ServiceMapper.ConfigureMapper(cfg);
            });
        }