public async Task SaveBarrierAsync(BarrierModel barrierModel)
        {
            var barrier = await GetBarrierEntityAsync();

            if (barrier == null)
            {
                await _barrierRepository.AddAsync(BarrierMapper.ToEntity(barrierModel));
            }
            else
            {
                await _barrierRepository.UpdateAsync(BarrierMapper.ToEntity(barrierModel));
            }
        }
        public void SaveBarrier(BarrierModel barrierModel)
        {
            var barrier = GetBarrierEntity();

            if (barrier == null)
            {
                _barrierRepository.Add(BarrierMapper.ToEntity(barrierModel));
            }
            else
            {
                _barrierRepository.Update(BarrierMapper.ToEntity(barrierModel));
            }
        }
Example #3
0
        public static Barrier ToEntity(BarrierModel barrier)
        {
            if (barrier == null)
            {
                return(null);
            }

            return(new Barrier
            {
                Id = barrier.Id,
                CountryPrefixId = barrier.NumberPrefix.Id,
                Number = barrier.Number,
                MessageText = barrier.MessageText
            });
        }
Example #4
0
 public void Init([NotNull] ModelContainer modelContainer)
 {
     Barrier = modelContainer.Get <BarrierModel>(_barrierId);
 }
 public BarrierMessage(object sender, BarrierModel barrier) : base(sender)
 {
     Barrier = barrier;
 }