예제 #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()));
 }