public async Task <bool> UpdateCamp(CampModel entity, string moniker)
        {
            var campUpdate = await _repository.ExecuteAsync(
                new Query("Camps")
                .Where("Camps.Moniker", moniker)
                .AsUpdate(new
            {
                Name      = entity.Name,
                Moniker   = entity.Moniker,
                EventDate = entity.EventDate,
                Length    = entity.Length
            })
                );

            var locationId = await _repository.GetAsync <int>(
                new Query("Camps")
                .Select("Camps.LocationId")
                .Where("Camps.moniker", moniker));

            var locationUpdate = await _repository.ExecuteAsync(
                new Query("Location")
                .Where("Location.LocationId", locationId)
                .AsUpdate(new
            {
                VenueName     = entity.Venue,
                Address1      = entity.LocationAddress1,
                Address2      = entity.LocationAddress2,
                Address3      = entity.LocationAddress3,
                CityTown      = entity.LocationCityTown,
                StateProvince = entity.LocationStateProvince,
                PostalCode    = entity.LocationPostalCode,
                Country       = entity.LocationCountry
            }));

            if (campUpdate && locationUpdate)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static Camp Map2Camp(Camp oldCamp, CampModel model)
        {
            oldCamp.Name      = model.Name;
            oldCamp.EventDate = model.EventDate;
            oldCamp.Moniker   = model.Moniker;
            oldCamp.Length    = model.Length;

            if (oldCamp.Location is null)
            {
                oldCamp.Location = new Location();
            }

            oldCamp.Location.Address1      = model.LocationAddress1;
            oldCamp.Location.Address2      = model.LocationAddress2;
            oldCamp.Location.Address3      = model.LocationAddress3;
            oldCamp.Location.CityTown      = model.LocationCityTown;
            oldCamp.Location.StateProvince = model.LocationStateProvince;
            oldCamp.Location.PostalCode    = model.LocationPostalCode;
            oldCamp.Location.Country       = model.LocationCountry;

            return(oldCamp);
        }
        public async Task <bool> AddCamp(CampModel entity)
        {
            _logger.LogInformation($"Adding an object of type {entity.GetType()} to the context.");

            await _repository.ExecuteAsync(
                new Query("Location")
                .AsInsert(new
            {
                VenueName     = entity.Venue,
                Address1      = entity.LocationAddress1,
                Address2      = entity.LocationAddress2,
                Address3      = entity.LocationAddress3,
                CityTown      = entity.LocationCityTown,
                StateProvince = entity.LocationStateProvince,
                PostalCode    = entity.LocationPostalCode,
                Country       = entity.LocationCountry
            }));

            var locationId = await _repository.CreateAndReturnIdAsync(
                new Query("Location")
                .Select("LocationId")
                .Where("Location.VenueName", entity.Venue));

            await _repository.ExecuteAsync(
                new Query("Camps")
                .AsInsert(new
            {
                Name       = entity.Name,
                Moniker    = entity.Moniker,
                EventDate  = entity.EventDate,
                Length     = entity.Length,
                LocationId = locationId
            }));

            return(true);
        }