public IActionResult AllEnquiry(int id) { //get logged in users id var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); //if the user id is the correct id of the local admin or web app admin then allow them access if (userId == "5522117f-b819-45aa-85a3-d316af1717b5" || userId == "a03605d5-8298-4ef6-bdb2-b86988459297") { var houses = _houseRepository.GetAllHouses().OrderBy(p => p.Id); var enquirys = _enquiryRepository.GetAllEnquiry(); //create object and pass it to the view var enquiryViewModel = new EnquiryViewModel() { Title = "All enquiries are listed below", Houses = houses.ToList(), Enquiries = enquirys.ToList() }; //No error to be bassed in viewbag ViewBag.Error = ""; return(View(enquiryViewModel)); } //user is not an admin and will be retuned this error ViewBag.Error = "You are not an admin."; return(View()); }
public List <Enquiry> GetAllEnquiry(EnquiryAdvanceSearch enquiryAdvanceSearch) { return(_enquiryRepository.GetAllEnquiry(enquiryAdvanceSearch)); }