public bool CheckToken(CheckLoginInputDto inputDto) { var checkUsername = userRepository.GetQuery().Where(x => x.Email == inputDto.Username).Select(y => y.Email).ToString(); if (checkUsername == null) { return(false); } var checktoken = userRepository.GetQuery().Where(x => x.Email == inputDto.Username).Select(x => x.UserLogin.Token).ToString(); if (checktoken == null) { return(false); } DateTime checkExpiredDate = userRepository.GetQuery().Where(x => x.Email == inputDto.Username).Select(x => x.UserLogin.ExpireMembershipDate).FirstOrDefault(); if (checkExpiredDate < DateTime.UtcNow) { return(true); } else { return(false); } }
public async Task CommentByUser([FromHeader] CheckLoginInputDto _checkLoginInputDto, [FromBody] CommentsInputDto _commentInputDto) { if (userLoginService.CheckToken(_checkLoginInputDto)) { await commentService.Insert(_commentInputDto); } else { //ino bayad avaz konim } }
public void RateByUser([FromHeader] CheckLoginInputDto _checkLoginInputDto, [FromBody] RateByUserInputDto _rateByUserInputDto) { if (userLoginService.CheckToken(_checkLoginInputDto)) { moviesService.RateByUser(_rateByUserInputDto); } else { //ino bayad avaz konim } }