Example #1
0
        public override async Task <DeleteDiscountResponse> DeleteDiscount(DeleteDiscountRequest request, ServerCallContext context)
        {
            bool deleted = await _discountRepository.DeleteDiscount(request.ProductName);

            return(new DeleteDiscountResponse {
                Success = deleted
            });
        }
        public async Task <ActionResult <bool> > DeleteDiscount(string productName)
        {
            bool status = await _repository.DeleteDiscount(productName);

            if (status)
            {
                return(Ok(status));
            }
            return(BadRequest());
        }
        public override async Task <DeleteDiscountResponse> DeleteDiscount(DeleteDiscountRequest request, ServerCallContext context)
        {
            var deleted = await _repository.DeleteDiscount(request.ProductName);

            var response = new DeleteDiscountResponse {
                Success = deleted
            };

            return(response);
        }
Example #4
0
        public override async Task <DeleteDiscountResponse> DeleteDiscount(DeleteDiscountRequest request, ServerCallContext context)
        {
            var deleted = await _discountRepository.DeleteDiscount(request.ProductName);

            _logger.LogInformation("Discount is successfully deleted. ProductName : {ProductName}", request.ProductName);

            return(new DeleteDiscountResponse
            {
                Success = deleted
            });
        }
Example #5
0
 public async Task <ActionResult <bool> > DeleteDiscount(string productName)
 {
     try
     {
         return(Ok(await _discountRepository.DeleteDiscount(productName)));
     }
     catch (Exception ex)
     {
         throw new Exception($"Failed to upgrade discount for: {productName}", ex);
     }
 }
Example #6
0
        public async Task <ActionResult> Delete(string productId)
        {
            bool success = await _discountRepository.DeleteDiscount(productId);

            if (!success)
            {
                return(NotFound());
            }

            return(NoContent());
        }
Example #7
0
 public async Task <ActionResult <bool> > DeleteDiscount(string productName)
 {
     try
     {
         //await _discountRepository.DeleteDiscount(productName);
         //return NoContent();
         return(Ok(await _discountRepository.DeleteDiscount(productName)));
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(StatusCode(StatusCodes.Status500InternalServerError, "Error deleting data from the database"));
     }
 }
Example #8
0
        public override async Task <DeleteDiscountResponse> DeleteDiscount(DeleteDiscountRequest request, ServerCallContext context)
        {
            bool deleted = await _discountRepository.DeleteDiscount(request.ProductId);

            if (!deleted)
            {
                _logger.LogError(new RpcException(new Status(StatusCode.NotFound,
                                                             $"Error finding result for productId={request.ProductId}")),
                                 $"Discount with ProductId={request.ProductId} has not been found.");
            }

            var response = new DeleteDiscountResponse {
                Success = deleted
            };

            return(response);
        }
Example #9
0
        public override async Task <DeleteDiscountResponse> DeleteDiscount(DeleteDiscountRequest request, ServerCallContext context)
        {
            try
            {
                var deleted = await _repository.DeleteDiscount(request.ProductName);
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed to delete coupon", ex);
            }

            var result = new DeleteDiscountResponse
            {
                Success = true
            };

            return(result);
        }
        public async Task <ActionResult> DeleteDiscount(int id)
        {
            try
            {
                var DiscountToDelete = await _trasection.GetDiscountById(id);

                if (DiscountToDelete == null)
                {
                    return(NotFound($"Discount with Id = {id} not found"));
                }

                await _trasection.DeleteDiscount(id);

                return(Ok("Record Deleted"));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Error deleting data"));
            }
        }
 public async Task<ActionResult<bool>> DeleteDiscount(string productName)
 {
     return Ok(await _repository.DeleteDiscount(productName));
 }
        public async Task <ActionResult <bool> > DeleteDiscount(string productName)
        {
            await _discountRepository.DeleteDiscount(productName).ConfigureAwait(false);

            return(Ok());
        }
Example #13
0
 public void DeleteDiscount(string pettype, string discount)
 {
     discountRepository.DeleteDiscount(pettype, discount);
 }
Example #14
0
 public IActionResult DeleteConfirmed(int id)
 {
     _discountRepository.DeleteDiscount(id);
     _discountRepository.Save();
     return(RedirectToAction("Index"));
 }
 public async Task <ActionResult <Coupon> > DeleteDiscount(string productName)
 {
     return(Ok(await _discountRepository.DeleteDiscount(productName)));
 }
 public async Task <bool> DeleteDiscount(string productName)
 {
     return(await _repository.DeleteDiscount(productName));
 }