Exemplo n.º 1
0
        public async Task <IActionResult> AddOpinion(string token, int lecturerId, Opinion opinion)
        {
            var accessType = await _authRepo.GetAccessTypeAsync(token);

            if (accessType < AccessType.User)
            {
                return(Unauthorized());
            }

            opinion.LecturerId = lecturerId;
            opinion.UserId     = _authRepo.GetUserForToken(token).Id;
            opinion.Date       = DateTime.Now;
            _lecturerRepo.AddOpinion(opinion);
            return(Ok());
        }