public async Task <UrlForVisitModel> GetURLForVisit(UrlForVisitModel Model) { return(await ExceptionHandler.CallMethod(async() => { var DashboardService = new DashboardService(); UrlForVisitModel result = null; if (DashboardService.CheckUrlVisit(Model, User.Identity.GetUserId())) { if (Model.URLAddress != null) { DashboardService.AddUrlVisit(Model, User.Identity.GetUserId()); } var role = ((ClaimsIdentity)User.Identity).Claims .Where(c => c.Type == ClaimTypes.Role) .Select(c => c.Value) .FirstOrDefault(); if (role == "Admin") { result = DashboardService.GetAdminURLForVisit(User.Identity.GetUserId(), Model.Duration, Model.Count, Model.Mobile); } else { result = DashboardService.GetURLForVisit(User.Identity.GetUserId(), Model.Duration, Model.Count, Model.Mobile); } } return result; })); }