Ignore:
Timestamp:
09/18/22 18:09:53 (2 years ago)
Author:
Danilo <danilo.najkov@…>
Branches:
master
Parents:
49b0bbd
Message:

vip functionallity + menu fields + alergens filtering + google/fb login + email queueing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • resTools_backend/backend/Controllers/ReviewsController.cs

    r49b0bbd r13f1472  
    1212    {
    1313        private readonly IReviewService _reviewService = null;
     14        private readonly IUserService _userService = null;
    1415
    15         public ReviewsController(IReviewService reviewService)
     16        public ReviewsController(IReviewService reviewService, IUserService userService)
    1617        {
    1718            _reviewService = reviewService;
     19            _userService = userService;
    1820        }
    1921
     
    3941                userId = (int)this.HttpContext.Items["User"];
    4042            }
    41             catch (Exception ex) { return null; }
     43            catch (Exception ex) {
     44                var user = await _userService.GetByEmail((string)this.HttpContext.Items["User"]);
     45                if (user == null)
     46                {
     47                    return null;
     48                }
     49                userId = user.Id;
     50            }
    4251            await _reviewService.AddReview(req, userId);
    4352            return Ok();
Note: See TracChangeset for help on using the changeset viewer.