public ActionResult Profile(User_Profile refProfile)
        {
            using (var context = new StripeEntities())
            {
                UserProfileExistCheck profileCheck = new UserProfileExistCheck();
                UserProfile           userProfile  = new UserProfile();
                if (profileCheck.UserProfileExistence(refProfile.userProfile_ID, context))
                {
                    userProfile.UserProfileUpdate(context, refProfile);

                    context.SP_USER_PROFILE_REFEREE_UPDATE(refProfile.ref_Game_Specialization_Type,
                                                           refProfile.userProfile_ID,
                                                           refProfile.Sport_Name_spt_Sport_Name_ID);
                    context.SaveChanges();
                }
                else
                {
                    //Inserting Profile
                    userProfile.UserProfileInsert(context, refProfile);

                    context.SP_USER_PROFILE_REFEREE_INSERT(refProfile.ref_Game_Specialization_Type,
                                                           refProfile.userProfile_ID,
                                                           refProfile.Sport_Name_spt_Sport_Name_ID);
                    context.SaveChanges();
                }

                return(RedirectToAction("Profile"));
            }
        }
Example #2
0
        public ActionResult CreateEvent(Sport_Event sportEventDetails)
        {
            if (ModelState.IsValid)
            {
                using (var context = new StripeEntities())
                {
                    int id = Convert.ToInt32(Session["loginid"]);

                    SchoolClass schoolRecord = new SchoolClass(context);
                    sportEventDetails.School_Home_sch_ID = schoolRecord.getSchoolDetailsFromDirector(id).sch_ID;

                    if (sportEventDetails.School_Away_sch_ID == sportEventDetails.School_Home_sch_ID)
                    {
                        ModelState.AddModelError("", "Cannot select same away and home team");
                        return(View());
                    }
                    else
                    {
                        sportEventDetails.event_Completion = "N";
                        context.Sport_Event.Add(sportEventDetails);
                        context.SaveChanges();
                        return(RedirectToAction("Home"));
                    }
                }
            }
            else
            {
                return(View("Error"));
            }
        }
Example #3
0
 public ActionResult UpdateStatus(int refereeId, int eventId, string status)
 {
     using (var context = new StripeEntities())
     {
         context.SP_UPDATE_REFEREE_STATUS_BY_EVENTID(eventId, refereeId, status);
         context.SaveChanges();
         return(RedirectToAction("ViewApplications", "Director", new { eventid = eventId }));
     }
 }
Example #4
0
        public ActionResult SignUp(Login login)
        {
            using (var context = new StripeEntities())
            {
                EncryptDecrypt encrypt = new EncryptDecrypt();
                login.login_random_string = encrypt.Encrypt(login.login_username, "r0b1nr0y");

                context.Logins.Add(login);
                context.SaveChanges();

                return(View("SignUpConfirmation"));
            }
        }
Example #5
0
        public ActionResult EditEvent(Sport_Event sportDetails)
        {
            using (var context = new StripeEntities())
            {
                context.SP_EVENT_DETAILS_UPDATE(sportDetails.event_Date,
                                                sportDetails.event_Time,
                                                sportDetails.event_School_Field_Name,
                                                sportDetails.Sport_Name_spt_Sport_Name_ID,
                                                sportDetails.event_ID);
                context.SaveChanges();

                return(RedirectToAction("ViewEvents", "Director"));
            }
        }
        public ActionResult Apply(FormCollection formCollection)
        {
            using (var context = new StripeEntities())
            {
                int eventId      = Convert.ToInt32(formCollection["event_ID"]);
                int refereeType  = Convert.ToInt32(formCollection["ref_Game_Specialization_Type"]);
                int homeSchoolId = Convert.ToInt32(formCollection["School_Home_sch_ID"]);
                int refereeId    = Convert.ToInt32(Session["loginid"]);

                SchoolClass schoolRecord  = new SchoolClass(context);
                var         schoolDetails = schoolRecord.GetDirectorIdFromSchoolId(homeSchoolId);

                context.SP_EVENT_REFEREE_APPLY(eventId, refereeId, schoolDetails.User_Profile_Director_Profile_ID, "P", refereeType);
                context.SaveChanges();

                return(RedirectToAction("AllEvents"));
            }
        }