示例#1
0
        public async Task <IActionResult> Focus(int?id)
        {
            if (Throttled && !ThrottlingService.CanAccess(User, Request, Request.Path))
            {
                return(StatusCode(429, ThrottleService.Message));
            }
            if (id.HasValue && User.IsInRole(RoleConstants.BoxUser))
            {
                await _preferenceService.SetPreference(User.GetId(), UserPreferenceType.BoxId, id?.ToString());

                return(await Detail(id));
            }
            else
            {
                await _preferenceService.ClearPreference(User.GetId(), UserPreferenceType.BoxId);

                return(Ok(1));
            }
        }