protected void UpdateAllOperators(SaveExOzOperatorCommand command)
        {
            List <string> apiOperatorNames = command.OperatorList.Select(w => w.Name).Distinct().ToList();

            var FilEvents     = _eventRepository.GetByNames(apiOperatorNames);
            var exOzOperators = _exOzOperatorRepository.GetByNames(apiOperatorNames);

            foreach (var item in command.OperatorList)
            {
                ExOzOperator exOzOperator = exOzOperators.Where(w => w.OperatorId == item.Id).FirstOrDefault();
                Event        FilEvent     = FilEvents.Where(w => w.Name == item.Name).FirstOrDefault();

                ExOzRegion exOzRegion = _exOzRegionRepository.GetByUrlSegment(item.RegionUrlSegment);
                City       FilCity    = _cityRepository.GetByName(exOzRegion.Name);
                Venue      FilVenue   = _venueRepository.GetByName(item.Geolocations[0].Address);

                //Venue
                try
                {
                    Venue        retVenue    = UpdateVenue(item, FilVenue, FilCity.Id, command.ModifiedBy);
                    Event        retEvent    = UpdateEvent(item, FilEvent, command.ModifiedBy);
                    ExOzOperator retOperator = UpdateOperator(item, exOzOperator, retEvent.Id, retVenue.Id, command.ModifiedBy);
                    updatedOperators.OperatorList.Add(retOperator);
                    UpdateAllOperatorImages(item, retOperator.Id, command.ModifiedBy);
                }
                catch (Exception e)
                {
                    throw;
                }
            }
        }
        protected ExOzOperator UpdateOperator(ExOzOperatorResponse item, ExOzOperator exOzOperator, long FilEventId, int FilVenueId, Guid ModifiedBy)
        {
            ExOzOperator exOzOperatorInserted = new ExOzOperator();

            if (exOzOperator == null)
            {
                var newExOzOperator = new ExOzOperator
                {
                    OperatorId = item.Id,
                    Name       = item.Name,
                    PublicName = item.PublicName,
                    UrlSegment = item.UrlSegment,
                    CanonicalRegionUrlSegment = item.CanonicalRegionUrlSegment,
                    RegionId        = item.RegionId,
                    EventId         = FilEventId,
                    VenueId         = FilVenueId,
                    Title           = item.Title,
                    Description     = item.Description,
                    Summary         = item.Summary,
                    Tips            = item.Tips,
                    Address         = item.Address,
                    Phone           = item.Phone,
                    Rating          = item.Rating,
                    Quantity        = item.Quantity,
                    Timestamp       = item.Timestamp,
                    GeoLocationName = item.Geolocations[0].Address,
                    Latitude        = item.Geolocations[0].Latitude,
                    Longitude       = item.Geolocations[0].Longitude,
                    ModifiedBy      = ModifiedBy,
                    IsEnabled       = true
                };
                exOzOperatorInserted = _exOzOperatorRepository.Save(newExOzOperator);
            }
            else
            {
                exOzOperator.IsEnabled  = true;
                exOzOperator.ModifiedBy = ModifiedBy;
                exOzOperatorInserted    = _exOzOperatorRepository.Save(exOzOperator);
            }
            return(exOzOperatorInserted);
        }
        protected void UpdateAllProducts(SaveExOzProductCommand command)
        {
            int           i = 0;
            List <string> apiProductNames = command.ProductList.Select(w => w.Name).Distinct().ToList();

            var FilEventDetails = _eventDetailRepository.GetByNames(apiProductNames);
            var exOzProducts    = _exOzProductRepository.GetByNames(apiProductNames);

            foreach (var item in command.ProductList)
            {
                i++;
                ExOzProduct exOzProduct    = exOzProducts.Where(w => w.ProductId == item.Id).FirstOrDefault();
                EventDetail FilEventDetail = FilEventDetails.Where(w => w.Name == item.Name).FirstOrDefault();

                ExOzOperator exOzOperator = _exOzOperatorRepository.GetByUrlSegment(item.OperatorUrlSegment);
                Event        FilEvent     = _eventRepository.GetAllByName(exOzOperator.Name).FirstOrDefault();
                //Venue FilVenue = _venueRepository.GetByName(item.Geolocations[0].Address);
                //if (FilVenue == null)
                //{
                //    ExOzRegion exOzRegion = _exOzRegionRepository.GetByUrlSegment(exOzOperator.CanonicalRegionUrlSegment);
                //    City FilCity = _cityRepository.GetByName(exOzRegion.Name);
                //    FilVenue = UpdateVenue(item.Geolocations[0], FilVenue, FilCity.Id, command.ModifiedBy);
                //}
                try
                {
                    EventDetail retEventDetail = UpdateEventDetail(item.Name, FilEventDetail, FilEvent.Id, (int)exOzOperator.VenueId, command.ModifiedBy);
                    ExOzProduct retProduct     = UpdateProduct(item, exOzProduct, retEventDetail.Id, (int)exOzOperator.VenueId, command.ModifiedBy);
                    updatedProducts.ProductList.Add(retProduct);
                    UpdateProductImages(item, retEventDetail.Id, retProduct.Id, command.ModifiedBy);
                    UpdateProductHighlights(item, retEventDetail.Id, retProduct.Id, command.ModifiedBy);
                }
                catch (Exception e)
                {
                    throw;
                }
            }
        }
 public void Delete(ExOzOperator exOzOperator)
 {
     _exOzOperatorRepository.Delete(exOzOperator);
 }
 public ExOzOperator Save(ExOzOperator exOzOperator)
 {
     return(_exOzOperatorRepository.Save(exOzOperator));
 }