public async Task <User> FindAsync(SigninDto dto) { var cache = _repositoryFacade.GetCache(dto.email.ToString()); UserDto userDto = JsonConvert.DeserializeObject <UserDto>(cache); if (userDto.email.ToString() == dto.email.ToString()) { User map = _mapper.Map <User>(userDto); return(map); } User user = await _userManager.FindByEmailAsync(dto.email); return(user); }
/// <summary> /// OnActionExecuting(ActionExecutingContext filterContext) - at the begining of a controller action /// </summary> /// <param name="filterContext"></param> public override void OnActionExecuting(ActionExecutingContext filterContext) { string name = "api_name." + Convert.ToString(filterContext.RouteData.Values["controller"]) + "." + Convert.ToString(filterContext.RouteData.Values["action"]); //expiry logic should go here var cache = _repositoryFacade.GetCache(name); if (cache != null) { var json_serializer = JObject.Parse(cache); foreach (var property in json_serializer.Properties()) { if (property.Name == "Value") { filterContext.Result = new JsonResult(property.Value); } } } }