/// <summary> /// Calculate percentage and count of adverts grouped by AdvertStatus column /// </summary> /// <returns>Listcontaining summary results</returns> public List <CountPercentSummary> CountAdvertByStatus() { var userId = User.Claims.FirstOrDefault(x => x.Type == "UserId").Value; var roleClaims = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Role).Value; if (roleClaims.Contains("ROLE_ADMIN")) { return(advertService.AdvertCountByStatus()); } else { long id = userId == null ? 0 : long.Parse(userId); return(advertService.AdvertCountByStatusByUser(id)); } }
/// <summary> /// Calculate percentage and count of adverts grouped by AdvertStatus column /// </summary> /// <returns>Listcontaining summary results</returns> public List <CountPercentSummary> CountAdvertByStatus() { return(advertService.AdvertCountByStatus()); }