public async Task <IEnumerable <RepresentativePlaceModel> > InsertRepresentativePlaceListAsync(IEnumerable <RepresentativePlaceModel> representativePlace)
        {
            var user = await userRepository.GetUser();

            List <RepresentativePlaceModel> repPlaceList = new List <RepresentativePlaceModel>();

            foreach (var repPlace in representativePlace)
            {
                var repPlaceVar = new RepresentativePlaceModel
                {
                    PlaceId            = repPlace.PlaceId,
                    UserId             = repPlace.UserId,
                    AddedDate          = DateTime.Now,
                    TenantId           = user.TenantId,
                    CreatorUserId      = requestIdentityProvider.UserId,
                    LastModifierUserId = requestIdentityProvider.UserId
                };
                repPlaceList.Add(repPlaceVar);
            }

            var newRepresentativePlace = representativePlaceRepository.InsertRepresentativePlaceList(mapper.Map <IEnumerable <RepresentativePlace> >(repPlaceList));
            await representativePlaceRepository.SaveChangesAsync();

            return(mapper.Map <IEnumerable <RepresentativePlaceModel> >(newRepresentativePlace));
        }
        public async Task <RepresentativePlaceModel> UpdateRepresentativePlaceAsync(RepresentativePlaceModel representativePlace)
        {
            var representativePlaceForUpdate = await representativePlaceRepository.GetAsync(representativePlace.Id);

            representativePlaceForUpdate.ModifiedDate = DateTime.Now;
            representativePlaceForUpdate.PlaceId      = representativePlace.PlaceId;
            representativePlaceForUpdate.UserId       = representativePlace.UserId;
            await representativePlaceRepository.SaveChangesAsync();

            return(mapper.Map <RepresentativePlaceModel>(representativePlaceForUpdate));
        }
        public async Task <RepresentativePlaceModel> InsertRepresentativePlaceAsync(RepresentativePlaceModel representativePlace)
        {
            var user = await userRepository.GetUser();

            representativePlace.AddedDate          = DateTime.Now;
            representativePlace.CreatorUserId      = requestIdentityProvider.UserId;
            representativePlace.LastModifierUserId = requestIdentityProvider.UserId;
            representativePlace.TenantId           = user.TenantId;

            var newRepresentativePlace = await representativePlaceRepository.InsertAsync(mapper.Map <RepresentativePlace>(representativePlace));

            await representativePlaceRepository.SaveChangesAsync();

            return(mapper.Map <RepresentativePlaceModel>(newRepresentativePlace));
        }