Esempio n. 1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Institution_Faculty_Qualification institution_faculty_qualification = await db.Institution_Faculty_Qualifications.FindAsync(id);

            db.Institution_Faculty_Qualifications.Remove(institution_faculty_qualification);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <ActionResult> Edit([Bind(Include = "IFQID,IFID,QualificationID")] Institution_Faculty_Qualification institution_faculty_qualification)
        {
            if (ModelState.IsValid)
            {
                db.Entry(institution_faculty_qualification).State = System.Data.Entity.EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.IFID            = new SelectList(db.Institution_Faculties, "IFID", "IFID", institution_faculty_qualification.IFID);
            ViewBag.QualificationID = new SelectList(db.Qualifications, "QualificationID", "Code", institution_faculty_qualification.QualificationID);
            return(View(institution_faculty_qualification));
        }
Esempio n. 3
0
        // GET: /LinkQualification/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Institution_Faculty_Qualification institution_faculty_qualification = await db.Institution_Faculty_Qualifications.FindAsync(id);

            if (institution_faculty_qualification == null)
            {
                return(HttpNotFound());
            }
            return(View(institution_faculty_qualification));
        }
Esempio n. 4
0
        // GET: /LinkQualification/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Institution_Faculty_Qualification institution_faculty_qualification = await db.Institution_Faculty_Qualifications.FindAsync(id);

            if (institution_faculty_qualification == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IFID            = new SelectList(db.Institution_Faculties, "IFID", "IFID", institution_faculty_qualification.IFID);
            ViewBag.QualificationID = new SelectList(db.Qualifications, "QualificationID", "Code", institution_faculty_qualification.QualificationID);
            return(View(institution_faculty_qualification));
        }
Esempio n. 5
0
        protected override void Seed(ApplicationDbContext context)
        {
            // fill institutions
            context.Institutions.Add(new Institution()
            {
                Name         = "University of Cape Town",
                abbreviation = "UCT",
                Extension1   = "myuct.ac.za"
            });
            context.Institutions.Add(new Institution()
            {
                Name         = "University of Western Cape",
                abbreviation = "UWC",
                Extension1   = "myuwc.ac.za"
            });
            context.Institutions.Add(new Institution()
            {
                Name         = "Cape Peninsula University of Technology",
                abbreviation = "CPUT",
                Extension1   = "mycput.ac.za"
            });

            // fill faculties
            context.Faculties.Add(new Faculty()
            {
                Name = "Science"
            });
            context.Faculties.Add(new Faculty()
            {
                Name = "Commerce"
            });
            context.Faculties.Add(new Faculty()
            {
                Name = "Law"
            });
            context.Faculties.Add(new Faculty()
            {
                Name = "Engineering"
            });

            // fill qualifications
            context.Qualifications.Add(new Qualification()
            {
                Code = "bsc", FullName = "Bachelor of Science"
            });
            context.Qualifications.Add(new Qualification()
            {
                Code = "beng", FullName = "Bachelor of Engineering"
            });
            context.Qualifications.Add(new Qualification()
            {
                Code = "bcom", FullName = "Bachelor of Commerce"
            });
            context.Qualifications.Add(new Qualification()
            {
                Code = "llb", FullName = "Bachelor of Law"
            });

            // fill majors
            context.Majors.Add(new Major()
            {
                Name = "Computer Science"
            });
            context.Majors.Add(new Major()
            {
                Name = "Information Systems"
            });
            context.Majors.Add(new Major()
            {
                Name = "3D Game Design"
            });
            context.Majors.Add(new Major()
            {
                Name = "Mathematics"
            });
            context.Majors.Add(new Major()
            {
                Name = "Applied Mathematics"
            });
            context.Majors.Add(new Major()
            {
                Name = "Statistics"
            });
            context.Majors.Add(new Major()
            {
                Name = "Physical Science"
            });

            // fill residents
            context.Residents.Add(new Resident()
            {
                Name = "Leo Marquard Hall"
            });
            context.Residents.Add(new Resident()
            {
                Name = "Liesbeeck Gardens"
            });
            context.Residents.Add(new Resident()
            {
                Name = "Forest Hill"
            });
            context.Residents.Add(new Resident()
            {
                Name = "Tugwel"
            });
            context.Residents.Add(new Resident()
            {
                Name = "Kopano"
            });
            context.Residents.Add(new Resident()
            {
                Name = "Baxter Hall"
            });
            context.Residents.Add(new Resident()
            {
                Name = "College House"
            });
            context.Residents.Add(new Resident()
            {
                Name = "University House"
            });

            // fill titles
            context.Titles.Add(new Title()
            {
                TitleID = "Mr"
            });
            context.Titles.Add(new Title()
            {
                TitleID = "Miss"
            });
            context.Titles.Add(new Title()
            {
                TitleID = "Mrs"
            });
            context.Titles.Add(new Title()
            {
                TitleID = "Ms"
            });
            context.Titles.Add(new Title()
            {
                TitleID = "Prof"
            });
            context.Titles.Add(new Title()
            {
                TitleID = "Dr"
            });

            // fill categories
            context.Categories.Add(new Category()
            {
                Name = "Fashion"
            });
            context.Categories.Add(new Category()
            {
                Name = "Electronics"
            });
            context.Categories.Add(new Category()
            {
                Name = "Service"
            });

            // fill

            // fill users
            var user = new ApplicationUser()
            {
                UserName = "******",
                Email    = "*****@*****.**",
                Faculty  = new Faculty()
                {
                    Name = "Humanity"
                },
                Intials = "MB",
                //PasswordHash = "123456",
                Surname = "Mapaila",
                Title   = new Title()
                {
                    TitleID = "Hr", Description = "Hero"
                },
                Qualification = new Qualification()
                {
                    Code = "BA", FullName = "Bachelor in Arts"
                },
                //InstitutionResident = new Institution_Resident()
                //{
                Institution = new Institution()
                {
                    abbreviation = "wits", Name = "Wits University", Extension1 = "wits.ac.za"
                },
                Resident = new Resident()
                {
                    Name = "Woolsack Resident"
                }
                //}
            };

            UserManager <ApplicationUser> UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));

            UserManager.Create(user, "springs35");

            // link some institutions and faculties
            Institution_Faculty InF = new Institution_Faculty()
            {
                Faculty = new Faculty()
                {
                    Name = "Information System"
                },
                Institution = new Institution {
                    abbreviation = "up", Extension1 = "myup.ac.za", Name = "University Of Pretoria"
                }
            };
            //context.Institution_Faculties.Add(InF);


            // link some institutions, faculties and qualifications
            Institution_Faculty_Qualification IFQ = new Institution_Faculty_Qualification()
            {
                Institution_Faculty = InF,
                Qualification       = new Qualification()
                {
                    Code = "PhD", FullName = "Doctor of Philosophy"
                }
            };

            //context.Institution_Faculty_Qualifications.Add(IFQ);

            // link some institutions, faculties, qualifications and majors
            context.Institution_Faculty_Qualification_Majors.Add(new Institution_Faculty_Qualification_Major()
            {
                Institution_Faculty_Qualification = IFQ,
                Major = new Major()
                {
                    Name = "Applied Mathematics"
                }
            });

            base.Seed(context);
        }