public async Task <DiscountModel> GetDiscount(string discountCode) { var discountRequest = new GetDiscountRequest { DiscountCode = discountCode }; return(await _discountProtoService.GetDiscountAsync(discountRequest)); }
public async Task <CouponModel> GetDiscount(string productName) { var discountRequest = new GetDiscountRequest { ProductName = productName }; return(await _discountProtoService.GetDiscountAsync(discountRequest)); }
public async Task <CouponModel> GetDiscount(int id) { var discountRequest = new GetDiscountRequest { Id = id }; return(await _discountProtoService.GetDiscountAsync(discountRequest)); }
public async Task <CouponResponse> GetDiscount(string productId) { var discountRequest = new GetDiscountRequest { ProductId = productId }; return(await _discountProtoService.GetDiscountAsync(discountRequest)); }
/// <summary> /// Get discount for particular product from Discount.Grpc service. /// </summary> /// <param name="productName">Name of particular product.</param> /// <returns></returns> public async Task <CouponModel> GetDiscount(string productName) { var discountRequest = new GetDiscountRequest { ProductName = productName }; // AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); return(await _discountProtoServiceClient.GetDiscountAsync(discountRequest)); }
public async Task <CouponModel> GetDiscount(string productName) { var discountRequest = new GetDiscountRequest { ProductName = productName }; //dohvaćamo getdiscount grpc service return(await _discountProtoServiceClient.GetDiscountAsync(discountRequest)); }
public async Task <DiscountModel> GetDiscount(string code) { var request = new GetDiscountRequest { DiscountCode = code }; return(await _discountProtoServiceClient.GetDiscountAsync(request)); }
public virtual async Task <IActionResult> Get(int customerId, ShoppingCartType shoppingCartType) { var shoppingCart = await _shoppingCartService.GetShoppingCart(customerId, shoppingCartType); if (shoppingCart.ShoppingCartItems != null && shoppingCart.ShoppingCartItems.Any()) { foreach (var cartItem in shoppingCart.ShoppingCartItems) { var coupon = await _discountProtoServiceClient.GetDiscountAsync(new GetDiscountRequest { ProductId = cartItem.ProductId }); _shoppingCartService.CalculateCartItemPrice(cartItem, coupon.Amount); } } var result = new SuccessDataResult(shoppingCart); return(Ok(result)); }