示例#1
0
        public ActionResult Create(Teacher t)
        {
            userRepo.Teachers.Add(t);
            userRepo.SaveChanges();

            TeacherFinancial financial = new TeacherFinancial();

            financial.TeacherId = t.TeacherId;
            financial.Salary    = (double)t.Salary;
            userRepo.TeacherFinancials.Add(financial);
            userRepo.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult ConfirmEnroll(int id)
        {
            CoursesOfStudent cos = new CoursesOfStudent();
            Subject          ss  = db.Subjects.Where(p => p.SubjectId == id).FirstOrDefault();

            cos.CourseName = ss.SubjectName;
            if (Session["Username"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            cos.StudentName = Session["Username"].ToString();
            cos.CourseId    = id;
            cos.TeacherId   = ss.TeacherId;

            db.CoursesOfStudents.Add(cos);
            ss.StudentCount += 1;
            db.SaveChanges();

            Registration re = new Registration();

            re.SubjectId   = ss.SubjectId;
            re.StudentName = Session["Username"].ToString();
            re.Fee         = ss.Price;
            db.Registrations.Add(re);
            db.SaveChanges();
            return(RedirectToAction("AllCourses"));
        }
        public ActionResult Edit(User t)
        {
            if (Session["Username"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            string name         = Session["Username"].ToString();
            User   userToUpdate = userRepo.Users.Where(x => x.UserName == name).FirstOrDefault();

            userToUpdate.UserName = t.UserName;
            userToUpdate.Password = t.Password;
            userToUpdate.UserType = t.UserType;
            userRepo.SaveChanges();
            return(RedirectToAction("ProfileInfo"));
        }
示例#4
0
        public ActionResult Create(Message m)
        {
            Message mg = new Message();

            if (Session["Username"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            string name  = Session["Username"].ToString();
            User   getTy = userRepo.Users.Where(l => l.UserName == name).FirstOrDefault();

            mg.SenderName   = Session["Username"].ToString();
            mg.SenderType   = getTy.UserType;
            mg.ReceiverName = m.ReceiverName;
            mg.Text         = m.Text;
            userRepo.Messages.Add(mg);
            userRepo.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult EditProfile(Teacher t, int?id)
        {
            if (Session["Username"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            string name = Session["Username"].ToString();

            Teacher profileToUpdate = erepo.Teachers.Where(p => p.UserName == name).FirstOrDefault();


            //profileToUpdate.TeacherId = id;
            profileToUpdate.TeacherName = t.TeacherName;
            profileToUpdate.MobileNo    = t.MobileNo;
            profileToUpdate.Institute   = t.Institute;
            profileToUpdate.Address     = t.Address;
            //profileToUpdate.ImageFile = t.ImageFile;


            erepo.SaveChanges();


            return(RedirectToAction("MyProfile"));
        }
 public ActionResult Create(Subject c)
 {
     userRepo.Subjects.Add(c);
     userRepo.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#7
0
 public ActionResult SignUp(User u)
 {
     userRepo.Users.Add(u);
     userRepo.SaveChanges();
     return(RedirectToAction("Login"));
 }
 public ActionResult Create(OnlineStudent s)
 {
     userRepo.OnlineStudents.Add(s);
     userRepo.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#9
0
 public ActionResult Contact(Message m)
 {
     userRepo.Messages.Add(m);
     userRepo.SaveChanges();
     return(RedirectToAction("Index"));
 }