コード例 #1
0
 public IActionResult GetCustomerByEmail(string email)
 {
     try
     {
         return(Ok(customerServices.GetCustomerByEmail(email)));
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
コード例 #2
0
        public async Task PostProductReview(string customerEmail, int id, string review, short rating)
        {
            var loggedOnCustomer = await _customerServices.GetCustomerByEmail(customerEmail);

            var productReview = new Review
            {
                CustomerId = loggedOnCustomer.CustomerId,
                ProductId  = id,
                Review1    = review,
                Rating     = rating,
                CreatedOn  = DateTime.Now
            };

            _context.Review.Add(productReview);

            await _context.SaveChangesAsync();
        }