public IActionResult GetAllAdvisor(int numpage = 1, int perpage = 10) { string[] inclue = { "AccountRoles" }; var listadvisor = _advisorService.GetAll(null, numpage, perpage, null).ToList(); if (listadvisor.Count > 0) { List <AdvisorAccountResponse> listadvisorinfor = new List <AdvisorAccountResponse>(); foreach (var advisor in listadvisor) { AdvisorAccountResponse advisorAccountResponse = new AdvisorAccountResponse(); var advisoracc = _accountservice.Get(a => a.Id == advisor.AccountId, inclue); advisorAccountResponse.Id = advisor.Id; advisorAccountResponse.CreateDate = advisoracc.AccountRoles.FirstOrDefault().CreateDate; advisorAccountResponse.Email = advisoracc.Email; advisorAccountResponse.Name = advisoracc.Firstname + " " + advisoracc.Lastname; listadvisorinfor.Add(advisorAccountResponse); } var totaladvisor = _advisorService.GetAll(null, 0, 0, null).ToList().Count(); var totalpage = Totalpagenumber(perpage, totaladvisor); return(StatusCode(200, new { listadvisor = listadvisorinfor, total = totalpage })); } else { return(StatusCode(404, new { message = "Advisors is empty" })); } }
public IEnumerable <Advisor> GetAll() { var advisors = _advisorService.GetAll(); return(advisors); }