예제 #1
0
        // GET: Activities/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var activity = await db.Activities
                           .Include(a => a.ActivityType)
                           .Include(a => a.Module)
                           .FirstOrDefaultAsync(m => m.Id == id);

            if (activity == null)
            {
                return(NotFound());
            }


            // Get all students that have uploaded a document to an Activity of type 'Assignment'
            var students = await db.Documents
                           .Where(d => d.ActivityId == activity.Id)
                           .Where(f => f.IsFinished == true)
                           .Select(s => s.AppUser)
                           .ToListAsync();

            var viewmodel = new ActivityDetailsViewModel
            {
                Activity = activity,
                Students = students
            };

            return(View(viewmodel));
        }
예제 #2
0
        public async Task <IActionResult> ActivityDetails(Guid id)
        {
            ActivityDetailsViewModel model = new ActivityDetailsViewModel();

            model.Activity = await _unitOfWork.Activities.GetByIdAsync(id);

            model.Users = await _unitOfWork.UserActivities.GetAllUsersByActivityIdAsync(id);

            var owner = await _unitOfWork.UserActivities.GetOwnerByActivityIdAsync(id);

            model.Owner = false;
            if (owner.Id == _userContext.Id)
            {
                model.Owner = true;
            }
            model.UserRatings    = new List <Rating>();
            model.UserActivities = new List <UserActivity>();
            foreach (var user in model.Users)
            {
                model.UserRatings.Add(await _unitOfWork.Ratings.GetRatingByUserIdAsync(user.Id));
                model.UserActivities.Add(await _unitOfWork.UserActivities.GetUserActivityByUserAndActivityAsync(user.Id, id));
            }
            model.Review = await _unitOfWork.Reviews.GetReviewByUserAndActivityAsync(_userContext.Id, id);

            return(View(model));
        }
예제 #3
0
        public ActionResult Details(int id)
        {
            var activity = _unitOfWork.Activities.GetActivities(id);

            if (activity == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new ActivityDetailsViewModel {
                Activity = activity
            };

            if (User.Identity.IsAuthenticated)
            {
                var userId = User.Identity.GetUserId();

                viewModel.IsAttending =
                    _unitOfWork.Attendances.GetAttendance(activity.Id, userId) != null;

                viewModel.IsFollowing =
                    _unitOfWork.Followings.GetFollowing(userId, activity.TeacherId) != null;
            }

            return(View("Details", viewModel));
        }
예제 #4
0
        public ActionResult ActivityDetails(int activityID)
        {
            ActivityDetailsViewModel activity = new ActivityDetailsViewModel();

            activity.Activity  = _activityManager.RetrieveActivityByID(activityID);
            activity.Attendees = _userManager.SelectUsersByActivityID(activityID);
            ViewBag.Title      = activity.Activity.ActivityName + "Details";
            return(View(activity));
        }
예제 #5
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var activity = await _context.Activities
                           .Include(v => v.Module)
                           .Include(v => v.ActivityType)
                           .FirstOrDefaultAsync(m => m.Id == id);

            if (activity == null || activity.Module is null)
            {
                return(NotFound());
            }

            var course = await _context.Courses.FirstOrDefaultAsync(a => a.Id == activity.Module.CourseId);

            if (course == null)
            {
                return(NotFound());
            }

            var model = new ActivityDetailsViewModel()
            {
                Id           = activity.Id,
                ModuleName   = activity.Module.Name,
                ModuleId     = activity.ModuleId,
                Description  = activity.Description,
                StartDate    = activity.StartDate,
                EndDate      = activity.EndDate,
                ActivityType = activity.ActivityType,
                Course       = course,
                Module       = activity.Module
            };

            var teachers = _userManager.GetUsersInRoleAsync("Teacher");

            teachers.Wait();
            var temp = teachers.Result;

            model.Documents = new List <DocumentListViewModel>();
            var documents = _context.ActivityDocument
                            .Where(d => d.ActivityId == id)
                            .Where(d => temp.Contains(d.User))
                            .ToList();

            foreach (var doc in documents)
            {
                var newDoc = _mapper.Map <DocumentListViewModel>(doc);
                newDoc.Filezise = (doc.DocumentData.Length).Bytes().Humanize("#.#");
                model.Documents.Add(newDoc);
            }

            return(View(model));
        }
예제 #6
0
        public ActionResult RunDetails(int IdActivity)
        {
            var activity = _activityRepository.Get(IdActivity);

            var listTelemetry = _telemetryRepository.GetTelemetries(IdActivity);

            var model = new ActivityDetailsViewModel()
            {
                IdActivity     = IdActivity,
                ActivityName   = activity.ActivityName,
                Status         = activity.Status,
                CreationDate   = activity.CreationDate,
                Location       = activity.Location,
                ActivityType   = activity.ActivityType,
                UriGara        = activity.UriGara,
                IdRunner       = activity.Runner_Id,
                arrayTelemetry = listTelemetry
            };

            return(View(model));
        }
예제 #7
0
        // GET: Activity/Details/5
        public ActionResult Details(Guid id)
        {
            if (!UserIsInRole("Professor"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            var result = _activityQuery.Handle(new ActivityInputGetById {
                ActivityId = id
            }).Activity;
            var activity = new ActivityDetailsViewModel
            {
                Id           = result.Id,
                Date         = result.Date.ToShortDateString(),
                Description  = result.Description,
                Value        = result.Value,
                Discipline   = result.Discipline.Name,
                DisciplineId = result.Discipline.Id
            };

            return(View(activity));
        }
예제 #8
0
        public IActionResult ActivityDetails(int id)
        {
            //int id = Int32.Parse(Request.Query["id"]);

            var activity = _activityRepository.Get(id);
            var list     = _telemetryRepository.GetFirstAndLastTelemetry(id);

            TimeSpan time = list.Last().Instant.Subtract(list.First().Instant);

            var runner = _runnerRepository.Get(activity.IdRunner);

            var details = new ActivityDetailsViewModel
            {
                LatitudeStart  = list.First().Latitude,
                LongitudeStart = list.First().Longitude,
                FirstName      = runner.FirstName,
                LastName       = runner.LastName,
                Time           = time,
            };

            return(View(details));
        }
예제 #9
0
 public ActivityDetailsPage()
 {
     this.InitializeComponent();
     vm = new ActivityDetailsViewModel();
 }