// POST: Students/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://go.microsoft.com/fwlink/?LinkId=317598. //[HttpPost] //[ValidateAntiForgeryToken] //public ActionResult Create([Bind(Include = "ID,LastName,FirstMidName,EnrollmentDate")] Student student) //{ // if (ModelState.IsValid) // { // db.Students.Add(student); // db.SaveChanges(); // return RedirectToAction("Index"); // } // return View(student); //} // GET: Students/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } studentprofile student = assessmentdb.studentprofile.Find(id); if (student == null) { return(HttpNotFound()); } student.username = UserValidation.FindUserName(student.useriD); return(View(student)); }
public ActionResult EditStudent(int id, string user_name, string first_name, string last_name, string dob, string email) { studentprofile sprofile = new studentprofile() { iD = id, FirstName = first_name, LastName = last_name, DoB = DateTime.ParseExact(dob, "MM/dd/yyyy HH:mm:ss tt", null), Emailaddress = email, Optional = "A", useriD = UserValidation.FindUserId(user_name) }; bool result = UserValidation.ModifyStudent(sprofile); return(View("Index", assessmentdb.studentprofile.ToList())); }
public ActionResult SubmitStudent(string user_name, string first_name, string last_name, string dob, string email) { studentprofile sprofile = new studentprofile() { iD = 0, FirstName = first_name, LastName = last_name, DoB = Convert.ToDateTime(dob), Emailaddress = email, Optional = "A", useriD = UserValidation.FindUserId(user_name) }; bool result = UserValidation.CreateStudent(sprofile); return(View("Create")); }