public ActionResult Edit([Bind(Include = "ProjectID,ProjectName,Abstract,Professor")] Project project)
 {
     if (ModelState.IsValid)
     {
         db.Entry(project).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(project));
 }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "MaterialNumber,DepartmentCode,CourseCode,SectionNumber,Semester,Year,LectureNumber,LectureName,PDF")] Material material)
 {
     if (ModelState.IsValid)
     {
         db.Entry(material).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Sections, "DepartmentCode", "DepartmentCode", material.DepartmentCode);
     return(View(material));
 }
 public ActionResult Edit([Bind(Include = "DepartmentCode,CourseCode,CourseTitle,CrediteHour,Syllabus")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Departments, "DepartmentCode", "DepartmentName", course.DepartmentCode);
     return(View(course));
 }
        public ActionResult Create([Bind(Include = "RequestId,CourseName,Type,Description")] Request request)
        {
            if (ModelState.IsValid)
            {
                db.Requests.Add(request);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(request));
        }
        public ActionResult Create(Link link)
        {
            if (ModelState.IsValid)
            {
                db.Links.Add(link);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(link));
        }
Esempio n. 6
0
        public ActionResult Create([Bind(Include = "StudentID,StudentName,DateOfBirth,Level,Mobile,StudentEmail,Password,ActivationCode,Verification")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(student));
        }
        public ActionResult Create([Bind(Include = "DepartmentCode,DepartmentName")] Department department)
        {
            if (ModelState.IsValid)
            {
                db.Departments.Add(department);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(department));
        }
        public ActionResult Create([Bind(Include = "TypeID,TypeName")] Models.Type type)
        {
            if (ModelState.IsValid)
            {
                db.Types.Add(type);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(type));
        }
Esempio n. 9
0
        public ActionResult Create([Bind(Include = "InstructorID,InstructorName")] Instructor instructor)
        {
            if (ModelState.IsValid)
            {
                db.Instructors.Add(instructor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(instructor));
        }
        public ActionResult Create([Bind(Include = "StudentID,SectionNumber,Semester,Year")] Transcript transcript)
        {
            if (ModelState.IsValid)
            {
                db.Transcripts.Add(transcript);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(transcript));
        }
        public ActionResult Create([Bind(Include = "QuestionId,DepartmentCode,CourseCode,SectionNumber,Question,Option1,Option2,Option3,Option4,Type")] Test test)
        {
            if (ModelState.IsValid)
            {
                db.Tests.Add(test);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Type = new SelectList(db.Types, "TypeID", "TypeName", test.Type);
            return(View(test));
        }
Esempio n. 12
0
        public ActionResult Create([Bind(Include = "RoleNumber,Role1,StudentID,RoleDescription")] Role role)
        {
            if (ModelState.IsValid)
            {
                db.Roles.Add(role);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", role.StudentID);
            return(View(role));
        }
Esempio n. 13
0
        public ActionResult Create([Bind(Include = "DepartmentCode,CourseCode,SectionNumber,Semester,Year,InstructorID")] Section section)
        {
            if (ModelState.IsValid)
            {
                db.Sections.Add(section);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentCode = new SelectList(db.Departments, "DepartmentCode", "DepartmentName ", section.DepartmentCode);
            ViewBag.CourseCode     = new SelectList(db.Courses, "CourseCode", "CourseTitle ", section.CourseCode);
            ViewBag.InstructorID   = new SelectList(db.Instructors, "InstructorID", "InstructorName", section.InstructorID);
            return(View(section));
        }
        public ActionResult Edit(Models.Student userprofile)
        {
            if (ModelState.IsValid)
            {
                string username = User.Identity.Name;
                // Get the userprofile
                Models.Student user = db.Students.FirstOrDefault(u => u.StudentEmail.Equals(username));

                // Update fields
                user.StudentName = userprofile.StudentName;
                user.Level       = userprofile.Level;
                user.Mobile      = userprofile.Mobile;
                user.DateOfBirth = userprofile.DateOfBirth;

                user.StudentEmail    = userprofile.StudentEmail;
                user.Password        = userprofile.Password;
                db.Entry(user).State = EntityState.Modified;

                db.SaveChanges();

                return(RedirectToAction("Index", "Home")); // or whatever
            }

            return(View(userprofile));
        }
        public ActionResult Create(Course course)
        {
            //if (ModelState.IsValid)
            //{
            //    db.Courses.Add(course);
            //    db.SaveChanges();
            //    return RedirectToAction("Index");
            //}

            string fileName  = Path.GetFileNameWithoutExtension(course.file.FileName);
            string extension = Path.GetExtension(course.file.FileName);

            fileName        = fileName + DateTime.Now.ToString("yymmssff") + extension;
            course.Syllabus = "~/uploads/" + fileName;
            fileName        = Path.Combine(Server.MapPath("~/uploads/"), fileName);
            course.file.SaveAs(fileName);
            using (StudentServiceEntities db = new StudentServiceEntities())
            {
                db.Courses.Add(course);
                db.SaveChanges();
            }

            ViewBag.DepartmentCode = new SelectList(db.Departments, "DepartmentCode", "DepartmentName", course.DepartmentCode);
            ModelState.Clear();


            return(View(course));
        }
Esempio n. 16
0
 public ActionResult Create([Bind(Include = "TaskNumber,DepartmentCode,CourseCode,SectionNumber,Semester,Year,TaskHeader,TaskDetails,Type")] Task task)
 {
     if (ModelState.IsValid)
     {
         db.Tasks.Add(task);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Departments, "DepartmentCode", "DepartmentCode", task.DepartmentCode);
     ViewBag.CourseCode     = new SelectList(db.Sections, "CourseCode", "CourseCode", task.CourseCode);
     ViewBag.SectionNumber  = new SelectList(db.Sections, "SectionNumber", "SectionNumber", task.SectionNumber);
     ViewBag.Semester       = new SelectList(db.Sections, "Semester", "Semester", task.Semester);
     ViewBag.Year           = new SelectList(db.Sections, "Year", "Year", task.Year);
     ViewBag.Type           = new SelectList(db.Types, "TypeID", "TypeID", task.Type);
     return(View(task));
 }
Esempio n. 17
0
        public ActionResult Create(Material material)
        {
            ViewBag.DepartmentCode = new SelectList(db.Departments, "DepartmentCode", "DepartmentCode", material.DepartmentCode);
            ViewBag.CourseCode     = new SelectList(db.Sections, "CourseCode", "CourseCode", material.CourseCode);
            ViewBag.SectionNumber  = new SelectList(db.Sections, "SectionNumber", "SectionNumber", material.SectionNumber);
            ViewBag.Semester       = new SelectList(db.Sections, "Semester", "Semester", material.Semester);
            ViewBag.Year           = new SelectList(db.Sections, "Year", "Year", material.Year);

            string fileName  = Path.GetFileNameWithoutExtension(material.file.FileName);
            string extension = Path.GetExtension(material.file.FileName);

            fileName     = fileName + DateTime.Now.ToString("yymmssff") + extension;
            material.PDF = "~/uploads/" + fileName;
            fileName     = Path.Combine(Server.MapPath("~/uploads/"), fileName);
            material.file.SaveAs(fileName);
            using (StudentServiceEntities db = new StudentServiceEntities())
            {
                db.Materials.Add(material);

                db.SaveChanges();
            }


            ModelState.Clear();
            return(View(material));
        }
        public ActionResult Create([Bind(Include = "DepartmentCode,DepartmentName")] Department department)
        {
            if (ModelState.IsValid)
            {
                var isExsist = IsExsist(department.DepartmentCode);
                if (isExsist)
                {
                    ModelState.AddModelError("CodeExist", "DepartmentCode is already Exist");

                    return(View(department));
                }
                db.Departments.Add(department);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(department));
        }
        public ActionResult Registration([Bind(Exclude = "Verification,ActivationCode")] Models.Student student)
        {
            bool   Status  = false;
            string Message = " ";

            if (ModelState.IsValid)
            {
                var isExsist = IsExsist(student.StudentEmail);
                if (isExsist)
                {
                    ModelState.AddModelError("EmailExist", "Email is already Exist");

                    return(View(student));
                }



                #region Generate Activation Code
                student.ActivationCode = Guid.NewGuid();
                #endregion

                #region Password Hashing
                student.Password         = Crypto.Hash(student.Password);
                student.ConfiremPassword = Crypto.Hash(student.ConfiremPassword);
                #endregion
                student.Verification = false;

                #region save data to data base
                using (StudentServiceEntities dc = new StudentServiceEntities())
                {
                    dc.Students.Add(student);
                    dc.SaveChanges();
                    //Send Email to User
                    Sendemailverifiction(student.StudentEmail, student.ActivationCode.ToString());
                    Message = "Registration successfully done. Account activation link " +
                              " has been sent to your email id:" + student.StudentEmail;
                    Status = true;
                }

                #endregion
            }
            else
            {
                Message = "Invalid Request";
            }
            ViewBag.Message = Message;
            ViewBag.Status  = Status;

            return(View(student));
        }
        public ActionResult Create(Project project)
        {
            string fileName  = Path.GetFileNameWithoutExtension(project.file.FileName);
            string extension = Path.GetExtension(project.file.FileName);

            fileName         = fileName + DateTime.Now.ToString("yymmssff") + extension;
            project.Abstract = "~/uploads/" + fileName;
            fileName         = Path.Combine(Server.MapPath("~/uploads/"), fileName);
            project.file.SaveAs(fileName);
            using (StudentServiceEntities db = new StudentServiceEntities())
            {
                db.Projects.Add(project);

                db.SaveChanges();
            }


            ModelState.Clear();
            return(View(project));
        }
Esempio n. 21
0
        public ActionResult VerifyAccount(string id)
        {
            bool Status = false;

            using (StudentServiceEntities dc = new StudentServiceEntities())
            {
                dc.Configuration.ValidateOnSaveEnabled = false; //to avoid

                var v = dc.Students.Where(a => a.ActivationCode == new Guid(id)).FirstOrDefault();
                if (v != null)
                {
                    v.Verification = true;
                    dc.SaveChanges();
                    Status = true;
                }
                else
                {
                    ViewBag.Message = "Invalid Request";
                }
            }
            ViewBag.Status = Status;
            return(View());
        }