Example #1
0
        public bool Delete(int id)
        {
            var entity = _vouRepo.GetById(id);

            if (entity == null)
            {
                return(false);
            }
            return(_vouRepo.Delete(entity));
        }
        public async Task <IActionResult> GetVoucherById(long id)
        {
            try
            {
                var voucherId = await _voucherRepository.GetById(id);

                return(Ok(voucherId));
            }
            catch (Exception e)
            {
                return(NotFound("The Voucher was not found"));
            }
        }
Example #3
0
        public async Task <IActionResult> Delete(int id)
        {
            var voucher = await _voucherRepository.GetById(id).ConfigureAwait(false);

            if (voucher == null)
            {
                return(NotFound($"No Voucher with Id '{id}' exists"));
            }

            await _voucherRepository.DeleteById(id).ConfigureAwait(false);

            return(Ok());
        }