Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "clinic_time,is_is_avalible,hospital_time,Clinic_day,hospial_day,doctor_id")] doctor_scedule doctor_scedule)
        {
            try
            {
                doctor_scedule.is_avalible = "No";

                if (ModelState.IsValid)
                {
                    db.doctor_scedule.Add(doctor_scedule);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
            {
                Exception raise = dbEx;
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        string message = string.Format("{0}:{1}",
                                                       validationErrors.Entry.Entity.ToString(),
                                                       validationError.ErrorMessage);
                        // raise a new exception nesting
                        // the current instance as InnerException
                        raise = new InvalidOperationException(message, raise);
                    }
                }
                throw raise;
            }

            return(View(doctor_scedule));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "password,Email")] AspNetUserLogin aspNetUserLogin)
        {
            if (ModelState.IsValid)
            {
                db.AspNetUserLogins.Add(aspNetUserLogin);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aspNetUserLogin));
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "name,email,contact_number,password")] patient patient)
        {
            if (ModelState.IsValid)
            {
                db.patients.Add(patient);
                db.SaveChanges();
                return(RedirectToAction("SelectDoctor"));
            }

            return(View(patient));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "doctor_id,name,date_of_birth,adress,phone,MBBS_Code,email,password,confirm_password,clinic_name,hospital_address,hospital_name,clinic_address,city,specialization,practising_years")] doctor doctor)
        {
            if (ModelState.IsValid)
            {
                db.doctors.Add(doctor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctor));
        }