Example #1
0
        private void AddTrip(Trip trip, ITripService tripService, IAreaService areaService, IUserService userService)
        {
            trip.User = userService.FindByEmail(trip.User.Email);
            if (trip.User == default(User))
            {
                throw new Exception("User doesn't exists.");
            }

            trip.Area = areaService.FindById(trip.Area.Id);
            if (trip.Area == default(Area))
            {
                throw new Exception("Area doesn't exists.");
            }
            tripService.Add(trip);
        }