Пример #1
0
        public async Task <IActionResult> Index()
        {
            List <HealthModel> logList = new List <HealthModel>();

            logList.AddRange(await _HealthRepo.GetList());
            if (User.IsInRole("Runner"))
            {
                //TODO: change to SQL Command
                List <HealthModel> runnerList = new List <HealthModel>();
                string             username   = UserManager.GetUserName(this.User);
                foreach (HealthModel log in logList)
                {
                    if (log.PostedBy == username)
                    {
                        runnerList.Add(log);
                    }
                }
                return(View(runnerList));
            }
            return(View(logList));
        }