public IActionResult CalculateFinalPrice(EstimateRequest estimateRequest) { IActionResult res = null; var response = new EstimateResponse(); //Validation if (!Regex.IsMatch(estimateRequest.Email, @"^[^@\s]+@[^@\s]+\.[^@\s]+$")) { response.Success = false; response.FailureInformation = "EMail ID not in proper format!"; } if (!(estimateRequest.GoldPrice > 0.0 && estimateRequest.Weight > 0.0)) { response.Success = false; response.FailureInformation = "GoldPrice and/or Weight should be greater than 0!"; } else { response = _shoppingRepository.EstimateFinalPrice(estimateRequest); } res = Ok(response); return(res); }