public ActionResult Create([Bind(Include = "id,first_name,last_name,title,email,gender,address,phone")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                db.Doctors.Add(doctor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctor));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "id,doc_id,date,time")] Appointment appointment)
        {
            appointment.userID = User.Identity.GetUserId();
            ModelState.Clear();
            TryValidateModel(appointment);

            if (ModelState.IsValid)
            {
                db.Appointments.Add(appointment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.doc_id = new SelectList(db.Doctors, "id", "Fullname", appointment.doc_id);
            return(View(appointment));
        }