Exemple #1
0
        public ActionResult addtodb(int sid, string sname, int scount, int eid, string city)
        {
            automatedexamsEntities1 e = new automatedexamsEntities1();
            school sc   = new school();
            bool   flag = false;

            foreach (var v in e.exams)
            {
                if (v.eid == eid)
                {
                    flag = true;
                }
            }
            if (flag)
            {
                sc.sid    = sid;
                sc.sname  = sname;
                sc.count  = scount;
                sc.examid = eid;
                sc.city   = city;
                e.schools.Add(sc);
                e.SaveChanges();
            }

            return(View());
        }
Exemple #2
0
        public ActionResult addtodb(int examid, string ename, int scount, int year)
        {
            automatedexamsEntities1 e = new automatedexamsEntities1();
            exam ex = new exam();

            ex.eid          = examid;
            ex.ename        = ename;
            ex.subjectcount = scount;
            ex.year         = year;
            e.exams.Add(ex);
            e.SaveChanges();
            return(View());
        }