Пример #1
0
 public GenericResponse <Guid> Create()
 {
     return(CatchErrorHelper.Try(() =>
     {
         var roulette = new Roulette();
         roulette.Id = Guid.NewGuid();
         roulette.State = RouletteState.Created;
         roulette.CreationDateTime = DateTime.UtcNow;
         DynamoRepository.Create(roulette);
         return roulette.Id;
     }));
 }
Пример #2
0
        public GenericResponse <Roulette> CloseRoulette(Guid id)
        {
            return(CatchErrorHelper.Try(() =>
            {
                var rouletteInCache = this.CacheRepository.Get <Roulette>(id);

                if (rouletteInCache.State != RouletteState.Closed)
                {
                    rouletteInCache.State = RouletteState.Closed;
                    rouletteInCache.CloseDateTime = DateTime.UtcNow;
                    RouletteService.CloseRoulette(rouletteInCache);
                }

                CacheRepository.Save(id, rouletteInCache);
                DynamoRepository.Edit(rouletteInCache);
                return rouletteInCache;
            }));
        }
Пример #3
0
        public GenericResponse <bool> OpenRoulette(Guid id)
        {
            return(CatchErrorHelper.Try(() =>
            {
                var entity = DynamoRepository.Details(id);

                if (entity == null)
                {
                    throw new Exception($"Ruleta no encontrada con Id: {id}");
                }

                RouletteService.IsValidRouletteToOpen(entity);
                entity.State = RouletteState.Opened;
                entity.OpenDateTime = DateTime.UtcNow;
                DynamoRepository.Edit(entity);
                CacheRepository.Save(id, entity);
                return true;
            }));
        }
Пример #4
0
 public T Delete(int id)
 {
     return(CatchErrorHelper.Try(() => GenericService.Delete(id)));
 }
Пример #5
0
 public T Edit(T entity)
 {
     return(CatchErrorHelper.Try(() => GenericService.Edit(entity)));
 }
Пример #6
0
 public T Create(T entity)
 {
     return(CatchErrorHelper.Try(() => GenericService.Create(entity)));
 }
Пример #7
0
 public List <T> GetAll()
 {
     return(CatchErrorHelper.Try(() => GenericService.GetAll()));
 }
 public GenericResponse <Bet> GetABet(Guid id)
 {
     return(CatchErrorHelper.Try(() => BetService.GetABet(id)));
 }
Пример #9
0
 public GenericResponse <bool> Delete(Guid id)
 {
     return(CatchErrorHelper.Try(() => GenericService.Delete(id)));
 }
Пример #10
0
 public GenericResponse <T> Edit(T entity)
 {
     return(CatchErrorHelper.Try(() => GenericService.Edit(entity)));
 }
Пример #11
0
 public GenericResponse <T> Details(Guid id)
 {
     return(CatchErrorHelper.Try(() => GenericService.Details(id)));
 }
Пример #12
0
 public GenericResponse <List <T> > GetAll()
 {
     return(CatchErrorHelper.Try(() => GenericService.GetAll()));
 }