public ActionResult <string> Login([FromBody] LoginUserParam loginUserParam) { try { var db = new ApplicationContext(); var userData = db.Users.FirstOrDefault(u => u.Email == loginUserParam.Email); if (userData == null) { return(_apiError.UserNotFount); } Sub.Publish( RedisEvents.Events.ChannelName, RedisContext.CreateMessage(RedisEvents.Events.LoginUserEvent, loginUserParam) ); var token = RetryGetToken(loginUserParam.Email); RedisCache.KeyDelete(loginUserParam.Email); return(token == null ? _apiError.UserNotFount : Ok(new { AccessToken = token })); } catch (Exception e) { Console.WriteLine(e); return(_apiError.ServerError); } }