public ActionResult Create([Bind(Include = "ID,Name,Email,Cell,NameOfClass,Subject")] AllTheTeacher allTheTeacher)
        {
            if (ModelState.IsValid)
            {
                db.AllTheTeachers.Add(allTheTeacher);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(allTheTeacher));
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "ID,EventName,EventDate,EventPlace,EventDetails")] Event @event)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(@event);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(@event));
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "VacationFor,StartDate,EndDate,ClassResumesOn")] Holiday holiday)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Holidays.Add(holiday);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }


            return(View(holiday));
        }
Ejemplo n.º 4
0

        
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "ID,Roll,SBA,Final,Total,GPA,Grade")] Phy phy)
        {
            if (ModelState.IsValid)
            {
                phy.Total = phy.SBA + phy.Final;
                if (phy.Total >= 80)
                {
                    phy.GPA = 4.00;
                }
                else if (phy.Total >= 75 && phy.Total < 80)
                {
                    phy.GPA = 3.75;
                }
                else if (phy.Total >= 70 && phy.Total < 75)
                {
                    phy.GPA = 3.50;
                }
                else if (phy.Total >= 65 && phy.Total < 70)
                {
                    phy.GPA = 3.25;
                }
                else if (phy.Total >= 60 && phy.Total < 65)
                {
                    phy.GPA = 3.00;
                }
                else if (phy.Total >= 55 && phy.Total < 60)
                {
                    phy.GPA = 2.75;
                }
                else if (phy.Total >= 50 && phy.Total < 55)
                {
                    phy.GPA = 2.50;
                }
                else if (phy.Total >= 45 && phy.Total < 50)
                {
                    phy.GPA = 2.25;
                }
                else if (phy.Total >= 40 && phy.Total < 45)
                {
                    phy.GPA = 2.00;
                }
                else if (phy.Total < 40)
                {
                    phy.GPA = 0.00;
                }

                if (phy.Total >= 80)
                {
                    phy.Grade = "A+";
                }
                else if (phy.Total >= 75 && phy.Total < 80)
                {
                    phy.Grade = "A";
                }
                else if (phy.Total >= 70 && phy.Total < 75)
                {
                    phy.Grade = "A-";
                }
                else if (phy.Total >= 65 && phy.Total < 70)
                {
                    phy.Grade = "B+";
                }
                else if (phy.Total >= 60 && phy.Total < 65)
                {
                    phy.Grade = "B";
                }
                else if (phy.Total >= 55 && phy.Total < 60)
                {
                    phy.Grade = "B-";
                }
                else if (phy.Total >= 50 && phy.Total < 55)
                {
                    phy.Grade = "C+";
                }
                else if (phy.Total >= 45 && phy.Total < 50)
                {
                    phy.Grade = "C";
                }
                else if (phy.Total >= 40 && phy.Total < 45)
                {
                    phy.Grade = "D";
                }
                else if (phy.Total < 40)
                {
                    phy.Grade = "F";
                }
                db.Physics.Add(phy);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(phy));
        }