예제 #1
0
        public ActionResult Create([Bind(Include = "QuotaID,QuotaName")] Quota quota)
        {
            if (ModelState.IsValid)
            {
                db.Quota.Add(quota);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(quota));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "DeciplineID,DeciplineName")] Decipline decipline)
        {
            if (ModelState.IsValid)
            {
                db.Decipline.Add(decipline);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(decipline));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "adminid,adminusername,adminpassword")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                db.Admin.Add(admin);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(admin));
        }
        public ActionResult Create(ApplicationViewModel application)
        {
            int id = Convert.ToInt32(Session["id"]);

            if (ModelState.IsValid)
            {
                foreach (var item in application.College)
                {
                    if (item.Checked)
                    {
                        foreach (var item1 in application.Decipline)
                        {
                            if (item1.Checked)
                            {
                                foreach (var item2 in application.Quota)
                                {
                                    if (item2.Checked)
                                    {
                                        db.Application.Add(new Application()
                                        {
                                            StudentID = id, CollegeID = item.Id, DeciplineID = item1.Id, QuotaID = item2.Id, Date = application.Date, ObtainedMarks = application.ObtainedMarks, TotalMarks = application.TotalMarks, Percentage = application.Percentage
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
                //db.Application.Add(application);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            //ViewBag.CollegeID = new SelectList(db.College, "CollegeID", "CollegeName", application.CollegeID);
            //ViewBag.DeciplineID = new SelectList(db.Decipline, "DeciplineID", "DeciplineName", application.DeciplineID);
            //ViewBag.QuotaID = new SelectList(db.Quotas, "QuotaID", "QuotaName", application.QuotaID);
            //ViewBag.StudentID = new SelectList(db.Student, "StudentID", "FirstName", application.StudentID);
            return(View(application));
        }
예제 #5
0
        public ActionResult Create(College college)
        {
            using (var Context = new EduMartEntities())
                if (ModelState.IsValid)
                {
                    var username = (from c in Context.College
                                    where c.CollegeEmail == college.CollegeEmail && c.CollegePassword == college.CollegePassword
                                    select c.CollegeName).FirstOrDefault();
                    if (username == null)
                    {
                        db.College.Add(college);
                        db.SaveChanges();
                        return(RedirectToAction("Application/Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Email Already Exists");
                        return(View());
                    }
                }

            return(View(college));
        }
예제 #6
0
        public ActionResult Create(Student student)
        {
            var Context = new EduMartEntities();

            if (ModelState.IsValid)
            {
                var username = (from s in Context.Student
                                where s.Email == student.Email && s.Password == student.Password
                                select s.FirstName).FirstOrDefault();
                if (username == null)
                {
                    db.Student.Add(student);
                    db.SaveChanges();
                    return(RedirectToAction("Application/Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Email Already Exists");
                    return(View());
                }
            }

            return(View(student));
        }