public static async Task <ResourceRatingModel> ResourceRatingService(int candidateid) { var ResourceRate = new ResourceRatingModel(); using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(TimeSheetAPIURl); HttpResponseMessage response = client.GetAsync(string.Format($"Resource/ResourceRating/{candidateid}")).Result; if (response.IsSuccessStatusCode) { ResourceRate = await response.Content.ReadAsAsync <ResourceRatingModel>(); } } return(ResourceRate); }
public ActionResult GetResourceRating(int candidateId) { if (UserRoles.UserCanEdit() == true) { if (ModelState.IsValid) { ResourceRatingModel model = new ResourceRatingModel(); model = CandidateService.ResourceRatingService(candidateId).Result; return(new JsonResult { Data = model, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } return(View()); } else { return(RedirectToAction("Index", "Candidates")); } }