Beispiel #1
0
        public ActionResult AddingReview([FromBody] ReviewRequest requestData)
        {
            if (requestData.ProductId == 0 || requestData.Rating == 0 || requestData.Comment == null || string.IsNullOrWhiteSpace(requestData.Email))
            {
                throw new Exception("request parameter incorrect.");
            }
            var data = _reviewService.AddingReview(requestData);

            if (data.ContainsKey(false))
            {
                throw new Exception(data.Values.FirstOrDefault());
            }
            return(Ok(data.Keys.FirstOrDefault()));
        }