static void Main(string[] args) { faculty f = new faculty(); Console.WriteLine(f.department); Console.ReadKey(); }
public ActionResult Login(student model) { if (ModelState.IsValid) { var Username = db.students.FirstOrDefault(x => x.username == model.username && x.password == model.password); if (Username != null) { faculty faculty = db.faculties.SingleOrDefault(f => f.facultyID == Username.facultyID); department department = db.departments.SingleOrDefault(d => d.departmentID == Username.departmentID); instructor instructor = db.instructors.SingleOrDefault(d => d.instructorID == Username.instructorID); Session["StudentName"] = Username.stufullname; Session["StudentNumber"] = Username.number; Session["StudentDep"] = department.depname; Session["StudentFac"] = faculty.facultyname; Session["studepid"] = Username.departmentID; Session["studentid"] = Username.studentID; Session["stufoto"] = Username.image; Session["stuinst"] = instructor.instfullname; Session["curriculum"] = department.curriculum; Session["Username"] = Username; ViewBag.curriculum = department.curriculum; return RedirectToAction("Index", "Home"); } else { ViewBag.Message = "Username or password wrong!!!"; } } return View(model); }
public async Task <IHttpActionResult> CreateFaculty([FromBody] faculty form) { try { //find duplicate faculty code var faculty = db.faculties.Where(a => a.faculty_code.ToString().ToUpper() == form.faculty_code.ToString().ToUpper()).FirstOrDefault(); if (faculty == null) { form.create_at = DateTime.Now; db.Entry(form).State = System.Data.Entity.EntityState.Added; int check = await db.SaveChangesAsync(); if (check > 0) { return(Ok(await ListFaculty())); } else { return(BadRequest("Create faculty error")); } } else { return(BadRequest("Duplicate faculty")); } } catch { return(BadRequest("Error")); } }
private JObject addStudyPlan(Command value) { var studyPlanObj = JsonConvert.DeserializeObject <StudyPlan>(value.data.ToString()); var major = new faculty(); major.name = studyPlanObj.major; major.idfaculty = Guid.NewGuid().ToString().Substring(0, 32).Replace("-", ""); _db.insertFaculty(ref major); group group = new group(); group.idgroups = Guid.NewGuid().ToString().Replace("-", ""); group.name = studyPlanObj.major; group.idsemesters = null; group.idsupergroup = null; group.idfaculty = major.idfaculty; studyPlanObj.id = group.idgroups; _db.insertGroup(ref group); foreach (SubGroup it in studyPlanObj.semesters) { semester semester = new semester(); semester.idsemesters = Guid.NewGuid().ToString().Replace("-", ""); semester.name = it.name; _db.insertSemester(ref semester); addGroup(it, semester.idsemesters, group.idgroups, major.idfaculty); } return(JObject.Parse(JsonConvert.SerializeObject(studyPlanObj))); }
public ActionResult DeleteConfirmed(int id) { faculty faculty = db.faculties.Find(id); db.faculties.Remove(faculty); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { faculty faculty = db.faculties.Find(id); faculty.is_deleted = true; faculty.modified_on = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "facultyID,facultyname")] faculty faculty) { if (ModelState.IsValid) { db.Entry(faculty).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(faculty)); }
public ActionResult Create([Bind(Include = "facultyID,facultyname")] faculty faculty) { if (ModelState.IsValid) { db.faculties.Add(faculty); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(faculty)); }
public ActionResult Edit([Bind(Include = "id,employee_id,first_name,middle_name,last_name,gender,birthdate,e_mail,mobile_number,work_number,is_deleted,created_by,created_on,modified_by,modified_on")] faculty faculty) { if (ModelState.IsValid) { db.Entry(faculty).State = EntityState.Modified; faculty.modified_on = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(faculty)); }
public FacultyViewModel(faculty f) { if (f != null) { this.Id = f.Id; this.FirstName = f.Firstname; this.LastName = f.Lastname; /* this.Offered = f.offereds * .Select(s => new OfferedViewModel(s)) * .ToList();*/ } }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } faculty faculty = db.faculties.Find(id); if (faculty == null) { return(HttpNotFound()); } return(View(faculty)); }
public async Task <IHttpActionResult> UpdateFaculty(int id, [FromBody] faculty form) { try { var findFac = db.faculties.Where(a => a.id == id).FirstOrDefault(); if (findFac != null) { //find duplicate faculty code var faculty = db.faculties.Where(a => a.faculty_code.ToString().ToUpper() == form.faculty_code.ToString().ToUpper() && a.id != id).FirstOrDefault(); if (faculty == null) { findFac.faculty_name = form.faculty_name; findFac.faculty_code = form.faculty_code; findFac.faculty_description = form.faculty_description; db.Entry(findFac).State = System.Data.Entity.EntityState.Modified; int check = await db.SaveChangesAsync(); if (check > 0) { return(Ok(await ListFaculty())); } else { return(BadRequest("Update faculty error")); } } else { return(BadRequest("Duplicate faculty")); } } else { return(BadRequest("Faculty not found.")); } } catch { return(BadRequest("Error")); } }
public static void Main(string[] args) { /*Console.WriteLine("Testing Address"); * Address addr1 = new Address(); * addr1.AddressLine1="1234 Main St"; * addr1.AddressLine2="Apt 102"; * addr1.City = "Cleveland"; * addr1.State = "azzffdsfd"; * addr1.Zipcode = "44143"; * * addr1.Display();*/ /*Console.WriteLine("Testing Person"); * Person p1 = new Person(); * p1.FirstName = "John"; * p1.LastName = "Smith"; * p1.PermanentAddress.AddressLine1 = "1234 Main St"; * p1.PermanentAddress.City = "Cleveland"; * p1.PermanentAddress.State = "OH"; * p1.PermanentAddress.Zipcode = "44143"; * p1.DateOfBirth = Convert.ToDateTime("07/13/1994"); * p1.Intro(); * p1.IsBirthday(); */ Console.WriteLine("Testing Student 1"); Student s1 = new Student(); s1.FirstName = "Kara"; s1.LastName = "Kaiser"; s1.DateOfBirth = Convert.ToDateTime("01/01/2020"); s1.PermanentAddress.AddressLine1 = "999 Mallard Dr"; s1.PermanentAddress.City = "Parma"; s1.PermanentAddress.State = "OH"; s1.PermanentAddress.Zipcode = "44143"; s1.GPA = 2.1; s1.School = "Cleveland State University"; s1.Intro(); s1.IsBirthday(); s1.SetAcademicStanding(); Console.WriteLine(s1.AcademicStanding); Console.WriteLine("Testing Student 2"); Student s2 = new Student("Andrew", "Peggman"); s2.DateOfBirth = Convert.ToDateTime("01/01/1989"); s2.PermanentAddress.AddressLine1 = "999 Mallard Dr"; s2.PermanentAddress.City = "Parma"; s2.PermanentAddress.State = "OH"; s2.PermanentAddress.Zipcode = "44143"; s2.GPA = 2.75; s2.School = "Ohio State University"; s2.Intro(); s2.IsBirthday(); s2.SetAcademicStanding(); Console.WriteLine(s2.AcademicStanding); Console.WriteLine("\nNew Faculty Member:"); faculty f1 = new faculty("Carl", "Malone", "Professor"); f1.Intro(); f1.GrantTenured(2000); f1.Raise(); f1.Promote(); }
public virtual void update faculty data() { throw new System.NotImplementedException(); }