public async Task <ActionResult <bool> > ChangeFontStyleAsync([FromBody] FontStyleModel fontStyle) { try { var token = ExtractHeader(HttpContext, "Authorization", ',', 1); var claims = new List <BusinessModels.UserAccessControl.UserClaimModel>(); claims.Add(new BusinessModels.UserAccessControl.UserClaimModel("Id", fontStyle.id.ToString())); var accessPolicy = _authorizationPolicyManager.ConfigureCustomPolicy(new List <string>() { "account.fontstyle:change" }, claims); return(await _userAccountSettingsService.ChangeFontStyleAsync(fontStyle.id, fontStyle.fontStyle)); } catch { return(false); } }
public async Task <ActionResult <FontStyleModel> > GetFontStyleAsync([FromBody] string id) { try { var token = ExtractHeader(HttpContext, "Authorization", ',', 1); var claims = new List <BusinessModels.UserAccessControl.UserClaimModel>(); claims.Add(new BusinessModels.UserAccessControl.UserClaimModel("Id", id.ToString())); var accessPolicy = _authorizationPolicyManager.ConfigureCustomPolicy(new List <string>() { "account.fontstyle:get" }, claims); FontStyleModel fontStyle = new FontStyleModel(); fontStyle.fontStyle = await _userAccountSettingsRepository.GetFontStyleByID(Int32.Parse(id)); return(fontStyle); } catch { return(StatusCode(404)); } }