Exemple #1
0
        public JsonResult Delete([FetchPoint(KeyName = "id")] PointHistoryEntity entity)
        {
            if (entity == null)
            {
                return(FailResponse());
            }

            using (var ts = new TransactionScope())
            {
                if (entity.Amount > 0)
                {
                    _userService.SubPoint(entity.User_Id, (int)entity.Amount, base.CurrentUser.CustomerId);
                }
                else
                {
                    _userService.AddPoint(entity.User_Id, (int)entity.Amount, base.CurrentUser.CustomerId);
                }

                entity.UpdatedDate = DateTime.Now;
                entity.UpdatedUser = CurrentUser.CustomerId;
                entity.Status      = (int)DataStatus.Deleted;
                _pointRepository.Delete(entity);
                ts.Complete();
            }
            return(SuccessResponse());
        }
Exemple #2
0
        public async Task CleanUp()
        {
            var token = new System.Threading.CancellationToken();
            IPointRepository repository = Provider.GetService <IPointRepository>();
            var points = await repository.GetAll(token);

            foreach (var item in points)
            {
                await repository.Delete(item.Id, token);
            }
        }
Exemple #3
0
        public async Task CleanUp()
        {
            var token  = new System.Threading.CancellationToken();
            var routes = await repository.GetAll(token);

            foreach (var item in routes)
            {
                await repository.Delete(item.Id, token);
            }
            var points = await repositoryPoint.GetAll(token);

            foreach (var item in points)
            {
                await repositoryPoint.Delete(item.Id, token);
            }
        }
        public IActionResult DeletePoint([FromRoute] int id)
        {
            try
            {
                Point point = _pointRepository.GetById(id);

                if (point == null)
                {
                    return(NotFound());
                }

                _pointRepository.Delete(point);

                return(Accepted());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
 public async Task Delete(int id)
 {
     await _pointRepository.Delete(id);
 }