Пример #1
0
        public ActionResult CreateEvent(CreateEventModel createEventObj)
        {
            Console.WriteLine("SetEvent triggered!");


            if (createEventObj.eventID == "NULL" || createEventObj.eventID == "null" || createEventObj.eventID == "Null")
            {
                return(RedirectToAction("Managment", "Home"));
            }



            EventModel eventObj = new EventModel();

            eventObj.eventID   = createEventObj.eventID;
            eventObj.startdate = createEventObj.startdate;
            eventObj.gender    = createEventObj.gender;
            eventObj.startdate = createEventObj.startdate;
            eventObj.eventtype = createEventObj.eventtype;

            Console.WriteLine(eventObj.eventID);
            Console.WriteLine(eventObj.startdate);
            Console.WriteLine(eventObj.gender);

            SqliteDataAccess.SaveEvent(eventObj);


            EventJudgeModel eventJudgeObj1 = new EventJudgeModel();
            EventJudgeModel eventJudgeObj2 = new EventJudgeModel();
            EventJudgeModel eventJudgeObj3 = new EventJudgeModel();

            eventJudgeObj1.eventID = createEventObj.eventID;
            eventJudgeObj1.judgeID = createEventObj.judge1ID;

            eventJudgeObj2.eventID = createEventObj.eventID;
            eventJudgeObj2.judgeID = createEventObj.judge2ID;

            eventJudgeObj3.eventID = createEventObj.eventID;
            eventJudgeObj3.judgeID = createEventObj.judge3ID;

            List <EventJudgeModel> eventJudgeObjList = new List <EventJudgeModel>();

            eventJudgeObjList.Add(eventJudgeObj1);
            eventJudgeObjList.Add(eventJudgeObj2);
            eventJudgeObjList.Add(eventJudgeObj3);

            foreach (var item in eventJudgeObjList)
            {
                Console.WriteLine("item: " + item.eventID + " " + item.judgeID);
            }


            string query = "insert into eventjudge(eventID, judgeID) values(@eventID, @judgeID)";

            SqliteDataAccess.SaveManyObjects(eventJudgeObjList, query);


            return(RedirectToAction("Managment", "Home"));
        }
Пример #2
0
        public ActionResult SetEvent(string EventNameField, string EventDateField, string EventGenderField, int Judge1Field, int Judge2Field, int Judge3Field)
        {
            Console.WriteLine("SetEvent triggered!");

            EventModel eventObj = new EventModel();

            eventObj.eventID   = EventNameField;
            eventObj.startdate = EventDateField;
            eventObj.gender    = EventGenderField;
            SqliteDataAccess.SaveEvent(eventObj);

            return(View("~/Views/Home/Application.cshtml"));
        }