示例#1
0
        public IEnumerable <ExerciseViewModel> Get()
        {
            var x = exerciseManager.GetAll();

            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Exercise, ExerciseViewModel>();
            });

            var collection = new List <ExerciseViewModel>();

            foreach (var item in x)
            {
                collection.Add(Mapper.Map <Exercise, ExerciseViewModel>(item));
            }

            return(collection);
        }
示例#2
0
        public IActionResult History()
        {
            try
            {
                var userName = User.Identity.Name;
                var user     = userManager.Users.Where(e => e.UserName == userName).FirstOrDefault();

                var codelst  = codeManager.Get().Where(e => e.UserId == user.Id).ToList();
                var history  = codeManager.GetAll().ToList();
                var exercise = exerciseManager.GetAll().ToList();

                return(View(new CodeHistoryViewModels
                {
                    CodeHistory = history,
                    Exercises = exercise,
                    UserCode = codelst,
                    UserName = user.UserName
                }));
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
示例#3
0
        public IActionResult Index()
        {
            var exerciseList = exerciseManager.GetAll();

            return(View(exerciseList));
        }