public ActionResult Details(int id)
 {
     if (!string.IsNullOrEmpty(Request.Headers["Referer"]))
     {
         ViewBag.Reffer = Request.Headers["Referer"].ToString();
     }
     return(View(_service.GetVisitDetails(id)));
 }
Example #2
0
        protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ManageDentistNameRequirement requirement)
        {
            var authFilterContext = context.Resource as Endpoint;
            //if(authFilterContext == null)
            //{
            //    return Task.CompletedTask;
            //}

            string loggedInUserName = context.User.Identity.Name;


            string visitIdBeingEdited = _contextAccessor.HttpContext.Request.Path;

            var visit   = _service.GetVisitDetails(Int32.Parse(visitIdBeingEdited.Split('/').Last()));
            var dentist = _service.GetDentistDetails(visit.DentistId);

            if (loggedInUserName == dentist.Dentist.Email)
            {
                context.Succeed(requirement);
            }
            return(Task.CompletedTask);
        }