コード例 #1
0
ファイル: HomeController.cs プロジェクト: alexmaris/WebSite
        public ActionResult Rate(int eventid, FormCollection frm)
        {
            CodeCampService.Rate rating = new CodeCampService.Rate();
            rating.UserID         = CurrentUser.ID;
            rating.EventID        = eventid;
            rating.RateSignin     = int.Parse(frm["RateSignin"]);
            rating.RateSwag       = int.Parse(frm["RateSwag"]);
            rating.RateFood       = int.Parse(frm["RateFood"]);
            rating.ReferralSource = int.Parse(frm["RefSource"]);
            rating.Comments       = frm["Comments"];
            List <CodeCampService.RateSession> rateSessions = new List <CodeCampService.RateSession>();

            for (int i = 0; i < 7; i++)
            {
                int timeslotID  = int.Parse(frm[string.Format("Timeslot_{0}", i)]);
                int sessionID   = int.Parse(frm[string.Format("SessionID_{0}", i)]);
                int rankSession = int.Parse(frm[string.Format("RateSession_{0}", i)]);
                if (rankSession > 0)
                {
                    CodeCampService.RateSession rateSession = new CodeCampService.RateSession();
                    rateSession.Rating     = rankSession;
                    rateSession.SessionID  = sessionID;
                    rateSession.TimeSlotID = timeslotID;
                    rateSessions.Add(rateSession);
                }
            }
            rating.RatedSessions = rateSessions.ToArray();
            service.CreateRateSession(rating);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: slobo80/WebSite
        public ActionResult Rate(int eventid, FormCollection frm)
        {
            CodeCampService.Rate rating = new CodeCampService.Rate();
            rating.UserID = CurrentUser.ID;
            rating.EventID = eventid;
            rating.RateSignin = int.Parse(frm["RateSignin"]);
            rating.RateSwag = int.Parse(frm["RateSwag"]);
            rating.RateFood = int.Parse(frm["RateFood"]);
            rating.ReferralSource = int.Parse(frm["RefSource"]);
            rating.Comments = frm["Comments"];
            List<CodeCampService.RateSession> rateSessions = new List<CodeCampService.RateSession>();
            for (int i = 0; i < 7; i++)
            {
                if (frm[string.Format("SessionID_{0}", i)] == null)
                    continue;

                int sessionID = int.Parse(frm[string.Format("SessionID_{0}", i)]);

                int timeslotID = int.Parse(frm[string.Format("Timeslot_{0}", i)]);
                int rankSession = int.Parse(frm[string.Format("RateSession_{0}", i)]);
                string comments = frm[string.Format("Comments_{0}", i)];
                if (rankSession > 0)
                {
                    CodeCampService.RateSession rateSession = new CodeCampService.RateSession();
                    rateSession.Rating = rankSession;
                    rateSession.SessionID = sessionID;
                    rateSession.TimeSlotID = timeslotID;
                    rateSession.Comments = comments;
                    rateSessions.Add(rateSession);
                }
            }
            rating.RatedSessions = rateSessions.ToArray();
            service.CreateRateSession(rating);
            return RedirectToAction("Index");
        }