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; })); }
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; })); }
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; })); }
public T Delete(int id) { return(CatchErrorHelper.Try(() => GenericService.Delete(id))); }
public T Edit(T entity) { return(CatchErrorHelper.Try(() => GenericService.Edit(entity))); }
public T Create(T entity) { return(CatchErrorHelper.Try(() => GenericService.Create(entity))); }
public List <T> GetAll() { return(CatchErrorHelper.Try(() => GenericService.GetAll())); }
public GenericResponse <Bet> GetABet(Guid id) { return(CatchErrorHelper.Try(() => BetService.GetABet(id))); }
public GenericResponse <bool> Delete(Guid id) { return(CatchErrorHelper.Try(() => GenericService.Delete(id))); }
public GenericResponse <T> Edit(T entity) { return(CatchErrorHelper.Try(() => GenericService.Edit(entity))); }
public GenericResponse <T> Details(Guid id) { return(CatchErrorHelper.Try(() => GenericService.Details(id))); }
public GenericResponse <List <T> > GetAll() { return(CatchErrorHelper.Try(() => GenericService.GetAll())); }