public JsonResult Get() { if (User.IsInRole("Admin")) { var results = Mapper.Map <IEnumerable <NurseryViewModel> >(_repository.GetAllNurseries()); return(Json(results)); } else { List <int> nursList = new List <int>(); var matchingNurs = User.FindAll("Nursery").ToList(); foreach (var nurs in matchingNurs) { nursList.Add(int.Parse(nurs.Value)); } var results = Mapper.Map <IEnumerable <NurseryViewModel> >(_repository.GetAllNurseries(nursList)); return(Json(results)); } }