private bool SaveCustomerPrice(CustomerPriceDto dto) { bool isSuccess = false; var customerPrices = _customerPriceService.GetAll().Where(cp => cp.ProductId == dto.ProductId && cp.CustomerId == dto.CustomerId).FirstOrDefault(); if (!customerPrices.IsNull()) { if (_customerPriceService.DeleteDetails(dto.CustomerId, dto.ProductId)) { if (_customerPriceService.SaveDetails(dto)) { isSuccess = true; } } } else { if (_customerPriceService.SaveDetails(dto)) { isSuccess = true; } } return(isSuccess); }
public virtual ActionResult GetCustomerAndProductPrice(int customerId, int productId) { decimal?price = 0; var customerPrice = _customerPriceService.GetAll().Where(c => c.CustomerId == customerId && c.ProductId == productId).FirstOrDefault(); if (!customerPrice.IsNull()) { price = customerPrice.Price; } var jsonResult = new { price = price }; return(Json(jsonResult, JsonRequestBehavior.AllowGet)); }