public ActionResult Create([Bind(Include = "batch_code,name,batch_starting_date,admission_last_date,room_number,faculty_name,amount,details,routine")] Batche batche)
        {
            if (ModelState.IsValid)
            {
                if (batche.admission_last_date >= batche.batch_starting_date)
                {
                    ModelState.AddModelError("admission_last_date", "Admission Last Date Cant Be Same As Batch Starting Date Or Greater Than Batch Starting Date!");
                    ViewBag.Day7           = MyCustomFunctions.Day7();
                    ViewBag.vendor_heading = new SelectList(db.Courses, "vendor_heading", "vendor_heading");
                    ViewBag.faculty_name   = new SelectList(db.Instructors, "faculty_name", "faculty_name");
                    ViewBag.name           = new SelectList(db.Courses, "name", "vendor_heading", batche.name);
                    return(View(batche));
                }
                db.Batches.Add(batche);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Day7           = MyCustomFunctions.Day7();
            ViewBag.vendor_heading = new SelectList(db.Courses, "vendor_heading", "vendor_heading");
            ViewBag.faculty_name   = new SelectList(db.Instructors, "faculty_name", "faculty_name");
            ViewBag.name           = new SelectList(db.Courses, "name", "vendor_heading", batche.name);

            return(View(batche));
        }
Ejemplo n.º 2
0
        public ActionResult ChangePassword([Bind(Include = "password,password0,password1")] User user, string password0, string password1)
        {
            if (password1 != user.password)
            {
                ViewBag.Message = "New Password And Confirm Password Is Not Match!";
                return(View(user));
            }
            else
            {
                int?id = (int)Session["UserDetailid"];

                UserDetail userdetail = db.UserDetails.Find(id);

                User olduser = db.Users.SingleOrDefault(c => c.UserId == userdetail.UserId);

                if (userdetail == null || user == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                if (olduser.password != password0)
                {
                    ViewBag.Message = "Old Password Is Not Match!";
                    return(View(user));
                }
                else
                {
                    TryUpdateModel(olduser, new string[] { "password" });
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
        }
Ejemplo n.º 3
0
 public ActionResult DeleteQuestionPost(int id)
 {
     //if ((string)Session["Userid"] != null && (string)Session["Level"] != null)
     //{
     //    if ((string)Session["Level"] == "admin")
     //    {
     using (TsmsDBContext context = new TsmsDBContext())
     {
         Question ques = context.Questions.SingleOrDefault(p => p.Id == id);
         context.Questions.Remove(ques);
         context.SaveChanges();
         Exam exam = context.Exams.SingleOrDefault(p => p.Id == ques.ExamID);
         exam.TotalQues = exam.TotalQues - 1;
         context.Exams.Attach(exam);
         var entry = context.Entry(exam);
         entry.Property(e => e.TotalQues).IsModified = true;
         context.SaveChanges();
         return(RedirectToAction("CreateQuestion", new { id = ques.ExamID }));
     }
     //    }
     //    else
     //    {
     //        return RedirectToAction("Index", "Exam");
     //    }
     //}
     //else
     //{
     //    return RedirectToAction("Index", "Exam");
     // }
 }
Ejemplo n.º 4
0
        public ActionResult AddQuestion(Question question)
        {
            //if ((string)Session["Userid"] != null && (string)Session["Level"] != null)
            //{
            //    if ((string)Session["Level"] == "admin")
            //    {
            using (TsmsDBContext context = new TsmsDBContext())
            {
                Exam exam = context.Exams.SingleOrDefault(EId => EId.Id == question.ExamID);
                exam.TotalQues          = (int)exam.TotalQues + 1;
                question.QuestionNumber = exam.TotalQues;
                context.Exams.Attach(exam);
                var entry = context.Entry(exam);
                entry.Property(e => e.TotalQues).IsModified = true;
                context.SaveChanges();

                context.Questions.Add(question);
                context.SaveChanges();


                return(RedirectToAction("CreateQuestion", new { id = question.ExamID }));
            }
            //    }
            //    else
            //    {
            //        return RedirectToAction("Index", "Exam");
            //    }
            //}
            //else
            //{
            //    return RedirectToAction("Index", "Exam");
            //}
        }
        public ActionResult Create([Bind(Include = "name,vendor_heading,code,pic_path,adding_date,details")] Course course, HttpPostedFileBase pic_path)
        {
            string pic             = null;
            var    SupportFileType = new[] { "image/gif", "image/x-png", "image/jpeg", "image/png" };

            if (ModelState.IsValid)
            {
                if (SupportFileType.Contains(pic_path.ContentType.ToLower().ToString()) == false)
                {
                    ModelState.AddModelError("pic_path", "Invalid File Type!");
                    ViewBag.vendor_heading = new SelectList(db.Vendors, "heading", "heading", course.vendor_heading);
                    return(View(course));
                }
                else if (pic_path.ContentLength > (5 * 1024 * 1024))
                {
                    ModelState.AddModelError("pic_path", "Max File Size Is 5 MB!");
                    ViewBag.vendor_heading = new SelectList(db.Vendors, "heading", "heading", course.vendor_heading);
                    return(View(course));
                }

                pic = Guid.NewGuid().ToString() + Path.GetFileName(pic_path.FileName);
                string CreateNewPath = "~/Content/img/tsms/course/" + pic;

                db.Courses.Add(new Course {
                    name           = course.name,
                    vendor_heading = course.vendor_heading,
                    code           = course.code,
                    pic_path       = CreateNewPath,
                    adding_date    = DateTime.Now,
                    details        = course.details
                });
                try
                {
                    db.SaveChanges();
                    if (pic_path != null)
                    {
                        string path = System.IO.Path.Combine(Server.MapPath("~/Content/img/tsms/course/"), pic);
                        pic_path.SaveAs(path);
                    }
                }
                catch (System.Data.SqlClient.SqlException e)
                {
                    ModelState.AddModelError(null, e.ToString());
                    ViewBag.vendor_heading = new SelectList(db.Vendors, "heading", "heading", course.vendor_heading);
                    return(View(course));
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateException e)
                {
                    ModelState.AddModelError(null, e.ToString());
                    ViewBag.vendor_heading = new SelectList(db.Vendors, "heading", "heading", course.vendor_heading);
                    return(View(course));
                }
                return(RedirectToAction("Index"));
            }

            ViewBag.vendor_heading = new SelectList(db.Vendors, "heading", "heading", course.vendor_heading);
            return(View(course));
        }
Ejemplo n.º 6
0
        public ActionResult ShowQuestion(FormCollection form)
        {
            //if ((string)Session["Userid"] != null && (string)Session["Level"] != null)
            //{
            using (TsmsDBContext context = new TsmsDBContext())
            {
                int  examId = Convert.ToInt32(Request.Form["hidden"]);
                Exam exam   = context.Exams.SingleOrDefault(p => p.Id == examId);
                for (int i = 1; i <= exam.TotalQues; i++)
                {
                    Answer ans = new Answer();
                    ans.StudentId  = (string)Session["Userid"];
                    ans.StuAns     = Convert.ToInt32(Request.Form[i.ToString()]);
                    ans.ExamId     = examId;
                    ans.QuestionId = Convert.ToInt32(Request.Form["QuesId" + i.ToString()]);
                    Question ques = context.Questions.SingleOrDefault(p => p.Id == ans.QuestionId);
                    if (ans.StuAns == ques.CorrectAns)
                    {
                        ans.Result = true;
                    }
                    else
                    {
                        ans.Result = false;
                    }

                    context.Answers.Add(ans);
                    context.SaveChanges();
                }
                List <Answer> answers = context.Answers.Where(p => p.ExamId == examId && p.StudentId == (string)Session["Userid"]).ToList();
                float         achived = 0;
                foreach (Answer answer in answers)
                {
                    if (answer.Result == true)
                    {
                        achived++;
                    }
                }
                Exam       examOb = context.Exams.SingleOrDefault(p => p.Id == examId);
                float      Marks  = achived * examOb.MarkPerQues;
                ExamAssign assign = context.ExamAssigns.SingleOrDefault(p => p.ExamID == examId && p.StudentID == Convert.ToString(Session["Userid"]));
                assign.gotMark = Marks.ToString();
                context.ExamAssigns.Attach(assign);
                var entry = context.Entry(assign);
                entry.Property(e => e.gotMark).IsModified = true;
                context.SaveChanges();
                float totalmarks = examOb.TotalQues * examOb.MarkPerQues;
                return(RedirectToAction("ShowResult", new { id = examId, total = totalmarks, achieved = Marks }));
            }
            //}
            //else
            //{
            //    return RedirectToAction("Index", "Exam");
            //}
        }
Ejemplo n.º 7
0
        public ActionResult Create([Bind(Include = "id,UserId,batch_code,debit,credit,balance,lastTrunsaction")] Financeofstudent financeofstudent)
        {
            if (ModelState.IsValid)
            {
                db.Financeofstudents.Add(financeofstudent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.batch_code = new SelectList(db.Batches, "batch_code", "name", financeofstudent.batch_code);
            ViewBag.UserId     = new SelectList(db.Users, "UserId", "password", financeofstudent.UserId);
            return(View(financeofstudent));
        }
Ejemplo n.º 8
0
        public ActionResult DeleteAssignStudentPost(int id)
        {
            //if ((string)Session["Userid"] != null && (string)Session["Level"] != null)
            //{
            //    if ((string)Session["Level"] == "admin")
            //    {
            using (TsmsDBContext context = new TsmsDBContext())
            {
                ExamAssign assign = context.ExamAssigns.SingleOrDefault(p => p.Id == id);
                int        examid = assign.ExamID;
                context.ExamAssigns.Remove(assign);
                context.SaveChanges();
                return(RedirectToAction("AssaignCourse", new { id = examid }));
            }
            //    }

            //    else
            //    {
            //        return RedirectToAction("Index", "Exam");
            //    }
            //}
            //else
            //{
            //    return RedirectToAction("Index", "Exam");
            //}
        }
Ejemplo n.º 9
0
 public ActionResult CreateExam(Exam exam)
 {
     //if (Session["Userid"] != null && Session["Level"] != null)
     //{
     //    if ((string)Session["Level"] == "admin")
     //    {
     //if (ModelState.IsValid)
     //{
     using (TsmsDBContext context = new TsmsDBContext())
     {
         exam.QuestionMaker = (string)Session["Userid"];
         exam.TotalQues     = 0;
         context.Exams.Add(exam);
         context.SaveChanges();
         return(RedirectToAction("ExamDetail", new { id = exam.Id }));
     }
     //            }
     //            else
     //            {
     //                return View();
     //            }
     //        }
     //        else
     //        {
     //            return RedirectToAction("Index", "Exam");
     //        }
     //    }
     //    else
     //    {
     //        return RedirectToAction("Index", "Exam");
 }
Ejemplo n.º 10
0
 public ActionResult EditQuestion(Question ques)
 {
     //if ((string)Session["Userid"] != null && (string)Session["Level"] != null)
     //{
     //    if ((string)Session["Level"] == "admin")
     //    {
     using (TsmsDBContext context = new TsmsDBContext())
     {
         context.Questions.Attach(ques);
         var entry = context.Entry(ques);
         entry.Property(e => e.QuestionTitle).IsModified = true;
         entry.Property(e => e.Option1).IsModified       = true;
         entry.Property(e => e.Option2).IsModified       = true;
         entry.Property(e => e.Option3).IsModified       = true;
         entry.Property(e => e.Option4).IsModified       = true;
         entry.Property(e => e.Option5).IsModified       = true;
         entry.Property(e => e.CorrectAns).IsModified    = true;
         context.SaveChanges();
         return(RedirectToAction("CreateQuestion", new { id = ques.ExamID }));
     }
     //    }
     //    else
     //    {
     //        return RedirectToAction("Index", "Exam");
     //    }
     //}
     //else
     //{
     //    return RedirectToAction("Index", "Exam");
     //}
 }
Ejemplo n.º 11
0
 public ActionResult DeleteExamPost(int id)
 {
     //if ((string)Session["Userid"] != null && (string)Session["Level"] != null)
     //{
     //    if ((string)Session["Level"] == "admin")
     //    {
     using (TsmsDBContext context = new TsmsDBContext())
     {
         Exam exam = context.Exams.SingleOrDefault(EId => EId.Id == id);
         context.Exams.Attach(exam);
         context.Exams.Remove(exam);
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     //    }
     //    else
     //    {
     //        return RedirectToAction("Index", "Exam");
     //    }
     //}
     //else
     //{
     //    return RedirectToAction("Index", "Exam");
     //}
 }
Ejemplo n.º 12
0
 public ActionResult EditExam(Exam exam)
 {
     //if (Session["Userid"] != null && Session["Level"] != null)
     //{
     //    if ((string)Session["Level"] == "admin")
     //    {
     using (TsmsDBContext context = new TsmsDBContext())
     {
         context.Exams.Attach(exam);
         var entry = context.Entry(exam);
         entry.Property(e => e.Course).IsModified      = true;
         entry.Property(e => e.Date).IsModified        = true;
         entry.Property(e => e.ExamState).IsModified   = true;
         entry.Property(e => e.FinishTime).IsModified  = true;
         entry.Property(e => e.MarkPerQues).IsModified = true;
         entry.Property(e => e.Name).IsModified        = true;
         entry.Property(e => e.StartTime).IsModified   = true;
         entry.Property(e => e.Type).IsModified        = true;
         context.SaveChanges();
         return(RedirectToAction("ExamDetail", new { id = exam.Id }));
     }
     //    }
     //    else
     //    {
     //        return RedirectToAction("Index", "Exam");
     //    }
     //}
     //else
     //{
     //    return RedirectToAction("Index", "Exam");
     //}
 }
Ejemplo n.º 13
0
        public ActionResult AssaignStudent(FormCollection form)
        {
            //if ((string)Session["Userid"] != null && (string)Session["Level"] != null)
            //{
            //    if ((string)Session["Level"] == "admin")
            //    {

            using (TsmsDBContext context = new TsmsDBContext())
            {
                List <ExamAssign> all = context.ExamAssigns.Where(p => p.StudentID == Request.Form["stuName"] && p.ExamID == Convert.ToInt32(Request.Form["ExamId"])).ToList();
                if (all == null)
                {
                    ViewBag.ExamId = Convert.ToInt32(Request.Form["ExamId"]);
                    ExamAssign assign = new ExamAssign();
                    assign.ExamID    = Convert.ToInt32(Request.Form["ExamId"]);
                    assign.StudentID = Request.Form["stuName"];
                    context.ExamAssigns.Add(assign);
                    context.SaveChanges();
                    List <ExamAssign> assaign = context.ExamAssigns.Where(p => p.ExamID == Convert.ToInt32(Request.Form["ExamId"])).ToList();
                    return(View(assaign));
                }
                else
                {
                    ViewBag.ExamId = Convert.ToInt32(Request.Form["ExamId"]);
                    List <ExamAssign> assaign = context.ExamAssigns.Where(p => p.ExamID == Convert.ToInt32(Request.Form["ExamId"])).ToList();
                    return(View(assaign));
                }
            }
            //    }
            //    else
            //    {
            //        return RedirectToAction("Index", "Exam");
            //    }
            //}
            //else
            //{
            //    return RedirectToAction("Index", "Exam");
            //}
        }
        public ActionResult Create([Bind(Include = "fullname,first_name,last_name,pic_path,company_name,city,phone_number,email,zip_code,nationality,sex,religion,blood_group,dob,user_activation_date")] UserDetail userdetail, HttpPostedFileBase pic_path)
        {
            ///create a student so level is student.....
            var SupportFileType = new[] { "image/gif", "image/x-png", "image/jpeg", "image/png" };

            if (ModelState.IsValid)
            {
                if (SupportFileType.Contains(pic_path.ContentType.ToLower().ToString()) == false)
                {
                    ModelState.AddModelError("pic_path", "Invalid File Type!");
                    return(View(userdetail));
                }
                else if (pic_path.ContentLength > (5 * 1024 * 1024))
                {
                    ModelState.AddModelError("pic_path", "Max File Size Is 5 MB!");
                    return(View(userdetail));
                }

                string pic           = Guid.NewGuid().ToString() + Path.GetFileName(pic_path.FileName);
                string CreateNewPath = "~/Content/img/tsms/student/" + pic;
                string userid        = MyCustomFunctions.GenerateUserId();
                db.UserDetails.Add(new UserDetail {
                    UserId               = userid,
                    first_name           = userdetail.first_name,
                    last_name            = userdetail.last_name,
                    fullname             = userdetail.fullname,
                    pic_path             = CreateNewPath,
                    company_name         = userdetail.company_name,
                    city                 = userdetail.city,
                    phone_number         = userdetail.phone_number,
                    email                = userdetail.email,
                    zip_code             = userdetail.zip_code,
                    nationality          = userdetail.nationality,
                    sex                  = userdetail.sex,
                    religion             = userdetail.religion,
                    blood_group          = userdetail.blood_group,
                    dob                  = userdetail.dob,
                    user_activation_date = DateTime.Now,
                    user_active          = userdetail.user_active,
                    User                 = new User()
                    {
                        UserId   = userid,
                        password = "******",
                        level    = "student"
                    }
                });
                try
                {
                    db.SaveChanges();
                    if (pic_path != null)
                    {
                        string path = System.IO.Path.Combine(Server.MapPath("~/Content/img/tsms/student/"), pic);
                        pic_path.SaveAs(path);
                    }
                }
                catch (System.Data.SqlClient.SqlException e)
                {
                    ModelState.AddModelError(null, e.ToString());
                    return(View(userdetail));
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateException e)
                {
                    ModelState.AddModelError(null, e.ToString());
                    return(View(userdetail));
                }
                return(RedirectToAction("Index"));
            }

            ViewBag.user_active = MyCustomFunctions.UserActivity();
            return(View(userdetail));
        }
Ejemplo n.º 15
0
        public ActionResult ShowQuestion(int id)
        {
            User CurrentUser = (User)Session["CurrentUser"];

            //if (Session["Userid"] != null)
            //{
            using (TsmsDBContext context = new TsmsDBContext())
            {
                Exam exam = context.Exams.SingleOrDefault(p => p.Id == id);
                if (CurrentUser.level == "admin")
                {
                    Answer ans = context.Answers.SingleOrDefault(p => p.ExamId == id && p.StudentId == CurrentUser.UserId);
                    if (ans == null)
                    {
                        ViewBag.ExamId = id;

                        ViewBag.Total = exam.TotalQues;
                        var      src     = DateTime.Now;
                        string   hour    = src.Hour.ToString();
                        string   min     = src.Minute.ToString();
                        string   end     = exam.FinishTime;
                        char[]   d       = { ' ', ':' };
                        string[] words   = end.Split(d, System.StringSplitOptions.RemoveEmptyEntries);
                        string   endHour = words[0];
                        string   endMin  = words[1];
                        ViewBag.duration  = ((Convert.ToInt32(endHour) * 60 + Convert.ToInt32(endMin)) - (Convert.ToInt32(hour) * 60 + Convert.ToInt32(min))) * 60 * 1000;
                        ViewBag.CountDown = exam.Date + " " + end + ":00";
                        List <Question> questions = context.Questions.Where(p => p.ExamID == id).ToList();
                        return(View(questions));
                    }
                    else
                    {
                        List <Answer> answers = context.Answers.Where(p => p.ExamId == id && p.StudentId == Convert.ToString(Session["Userid"])).ToList();
                        foreach (Answer ansob in answers)
                        {
                            context.Answers.Attach(ansob);
                            context.Answers.Remove(ansob);
                            context.SaveChanges();
                        }
                        ViewBag.ExamId = id;

                        ViewBag.Total = exam.TotalQues;
                        var      src     = DateTime.Now;
                        string   hour    = src.Hour.ToString();
                        string   min     = src.Minute.ToString();
                        string   end     = exam.FinishTime;
                        char[]   d       = { ' ', ':' };
                        string[] words   = end.Split(d, System.StringSplitOptions.RemoveEmptyEntries);
                        string   endHour = words[0];
                        string   endMin  = words[1];
                        ViewBag.duration  = ((Convert.ToInt32(endHour) * 60 + Convert.ToInt32(endMin)) - (Convert.ToInt32(hour) * 60 + Convert.ToInt32(min))) * 60 * 1000;
                        ViewBag.CountDown = exam.Date + " " + end + ":00";
                        List <Question> questions = context.Questions.Where(p => p.ExamID == id).ToList();
                        return(View(questions));
                    }
                }
                else
                {
                    if (exam.ExamState == "open")
                    {
                        ExamAssign assign = context.ExamAssigns.SingleOrDefault(p => p.StudentID == (string)Session["Userid"] && p.Id == id);
                        if (assign != null)
                        {
                            Answer ans = context.Answers.SingleOrDefault(p => p.ExamId == id && p.StudentId == Convert.ToString(Session["Userid"]));
                            if (ans == null)
                            {
                                ViewBag.ExamId = id;

                                ViewBag.Total = exam.TotalQues;
                                var      src     = DateTime.Now;
                                string   hour    = src.Hour.ToString();
                                string   min     = src.Minute.ToString();
                                string   end     = exam.FinishTime;
                                char[]   d       = { ' ', ':' };
                                string[] words   = end.Split(d, System.StringSplitOptions.RemoveEmptyEntries);
                                string   endHour = words[0];
                                string   endMin  = words[1];
                                ViewBag.duration  = ((Convert.ToInt32(endHour) * 60 + Convert.ToInt32(endMin)) - (Convert.ToInt32(hour) * 60 + Convert.ToInt32(min))) * 60 * 1000;
                                ViewBag.CountDown = exam.Date + " " + end + ":00";
                                List <Question> questions = context.Questions.Where(p => p.ExamID == id).ToList();
                                return(View(questions));
                            }
                            else
                            {
                                return(RedirectToAction("Index", "Exam"));
                            }
                        }
                        else
                        {
                            return(RedirectToAction("Index", "Exam"));
                        }
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Exam"));
                    }
                }
            }
            // }
            //else
            //{
            //    return RedirectToAction("Index", "Exam");
            //}
        }
Ejemplo n.º 16
0
        public ActionResult Create([Bind(Include = "pic_path,first_name,last_name,faculty_name,company_name,city,phone_number,email,zip_code,nationality,sex,religion,blood_group,dob,faculty_active")] Instructor instructor, HttpPostedFileBase pic_path)
        {
            var SupportFileType = new[] { "image/gif", "image/x-png", "image/jpeg", "image/png" };

            if (ModelState.IsValid)
            {
                if (SupportFileType.Contains(pic_path.ContentType.ToLower().ToString()) == false)
                {
                    ModelState.AddModelError("pic_path", "Invalid File Type!");
                    ViewBag.faculty_active = MyCustomFunctions.UserActivity();
                    return(View(instructor));
                }
                else if (pic_path.ContentLength > (5 * 1024 * 1024))
                {
                    ModelState.AddModelError("pic_path", "Max File Size Is 5 MB!");
                    ViewBag.faculty_active = MyCustomFunctions.UserActivity();
                    return(View(instructor));
                }

                string pic           = Guid.NewGuid().ToString() + Path.GetFileName(pic_path.FileName);
                string CreateNewPath = "~/Content/img/tsms/instructor/" + pic;
                db.Instructors.Add(new Instructor
                {
                    faculty_name            = instructor.first_name + " " + instructor.last_name,
                    pic_path                = CreateNewPath,
                    first_name              = instructor.first_name,
                    last_name               = instructor.last_name,
                    company_name            = instructor.company_name,
                    city                    = instructor.city,
                    phone_number            = instructor.phone_number,
                    email                   = instructor.email,
                    zip_code                = instructor.zip_code,
                    nationality             = instructor.nationality,
                    sex                     = instructor.sex,
                    religion                = instructor.religion,
                    blood_group             = instructor.blood_group,
                    dob                     = instructor.dob,
                    faculty_activation_date = DateTime.Now,
                    faculty_active          = instructor.faculty_active,
                });
                try
                {
                    db.SaveChanges();
                    if (pic_path != null)
                    {
                        string path = System.IO.Path.Combine(Server.MapPath("~/Content/img/tsms/instructor/"), pic);
                        pic_path.SaveAs(path);
                    }
                }
                catch (System.Data.SqlClient.SqlException e)
                {
                    ModelState.AddModelError(null, e.ToString());
                    ViewBag.faculty_active = MyCustomFunctions.UserActivity();
                    return(View(instructor));
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateException e)
                {
                    ModelState.AddModelError(null, e.ToString());
                    ViewBag.faculty_active = MyCustomFunctions.UserActivity();
                    return(View(instructor));
                }
                return(RedirectToAction("Index"));
            }

            ViewBag.faculty_active = MyCustomFunctions.UserActivity();
            return(View(instructor));
        }