Esempio n. 1
0
 public ActionResult <Dictionary <string, string> > GetStatistics(string AccountID)
 {
     if (AccountID.Length > 0 && AccountID.Length <= 50)
     {
         var account = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         if (AccountID.Equals(account, StringComparison.Ordinal))
         {
             return(Ok(_urlService.GetUrlStatistic(AccountID)));
         }
         else
         {
             return(Unauthorized("AccountID's from Authorization header and URI path dont match. You are only allowed to see your own statistic"));
         }
     }
     else
     {
         return(BadRequest("AccountID can be 0-50 characters long"));
     }
 }