コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            EnglishOneSeven englishOneSeven = db.EnglishOneSevens.Find(id);

            db.EnglishOneSevens.Remove(englishOneSeven);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,Roll,SBA,Final,Total,GPA,Grade")] EnglishOneSeven englishOneSeven)
 {
     if (ModelState.IsValid)
     {
         db.Entry(englishOneSeven).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(englishOneSeven));
 }
コード例 #3
0
        // GET: EnglishOneSeven/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EnglishOneSeven englishOneSeven = db.EnglishOneSevens.Find(id);

            if (englishOneSeven == null)
            {
                return(HttpNotFound());
            }
            return(View(englishOneSeven));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ID,Roll,SBA,Final,Total,GPA,Grade")] EnglishOneSeven englishOneSeven)
        {
            if (ModelState.IsValid)
            {
                englishOneSeven.Total = englishOneSeven.SBA + englishOneSeven.Final;
                if (englishOneSeven.Total >= 80)
                {
                    englishOneSeven.GPA = 4.00;
                }
                else if (englishOneSeven.Total >= 75 && englishOneSeven.Total < 80)
                {
                    englishOneSeven.GPA = 3.75;
                }
                else if (englishOneSeven.Total >= 70 && englishOneSeven.Total < 75)
                {
                    englishOneSeven.GPA = 3.50;
                }
                else if (englishOneSeven.Total >= 65 && englishOneSeven.Total < 70)
                {
                    englishOneSeven.GPA = 3.25;
                }
                else if (englishOneSeven.Total >= 60 && englishOneSeven.Total < 65)
                {
                    englishOneSeven.GPA = 3.00;
                }
                else if (englishOneSeven.Total >= 55 && englishOneSeven.Total < 60)
                {
                    englishOneSeven.GPA = 2.75;
                }
                else if (englishOneSeven.Total >= 50 && englishOneSeven.Total < 55)
                {
                    englishOneSeven.GPA = 2.50;
                }
                else if (englishOneSeven.Total >= 45 && englishOneSeven.Total < 50)
                {
                    englishOneSeven.GPA = 2.25;
                }
                else if (englishOneSeven.Total >= 40 && englishOneSeven.Total < 45)
                {
                    englishOneSeven.GPA = 2.00;
                }
                else if (englishOneSeven.Total < 40)
                {
                    englishOneSeven.GPA = 0.00;
                }

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

            return(View(englishOneSeven));
        }