public ActionResult Index()
        {
            var cepgpDirectory = new DirectoryInfo(Server.MapPath("~/CEPGP/"));
            var repository     = new FileStandingsRepository(cepgpDirectory);
            var members        = repository.GetMembers();

            var memberList = new MemberListDto
            {
                LastUpdateDate = JsonConvert.SerializeObject(members.LastUpdateDate),
                Members        = new List <MemberDto>()
            };

            foreach (var member in members)
            {
                memberList.Members.Add(new MemberDto
                {
                    Name = member.Name,
                    EP   = member.EP.Value,
                    GP   = member.GP.Value,
                    PR   = member.CalculatePR().Value
                });
            }

            return(Json(memberList, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        // GET: Standings
        public ActionResult Index()
        {
            var cepgpDirectory = new DirectoryInfo(Server.MapPath("~/CEPGP/"));

            var repository = new FileStandingsRepository(cepgpDirectory);
            var members    = repository.GetMembers();

            return(View(members));
        }
        public ActionResult Index()
        {
            var cepgpDirectory = new DirectoryInfo(Server.MapPath("~/CEPGP/"));

            var standingsRepository = new FileStandingsRepository(cepgpDirectory);
            var members             = standingsRepository.GetMembers();

            var lastSevenDays = new Period(DateTime.UtcNow.AddDays(-7), DateTime.UtcNow);

            var raidAttendanceRepository = new FileRaidAttendanceRepository(cepgpDirectory);
            var raidAttendance           = raidAttendanceRepository.GetRaidAttendance(members, lastSevenDays);

            return(View(raidAttendance));
        }
        public ActionResult Search(int daysInPast)
        {
            var cepgpDirectory = new DirectoryInfo(Server.MapPath("~/CEPGP/"));

            var standingsRepository = new FileStandingsRepository(cepgpDirectory);
            var members             = standingsRepository.GetMembers();

            var raidAttendanceRepository = new FileRaidAttendanceRepository(cepgpDirectory);

            IEnumerable <Attendance> raidAttendance;

            if (daysInPast == 0)
            {
                raidAttendance = raidAttendanceRepository.GetRaidAttendance(members, null);
            }
            else
            {
                var period = new Period(DateTime.UtcNow.AddDays(-daysInPast), DateTime.UtcNow);
                raidAttendance = raidAttendanceRepository.GetRaidAttendance(members, period);
            }

            return(View("Index", raidAttendance));
        }