示例#1
0
        public ActionResult Create(allahmed inter)
        {
            User u = Getcurrentuser();

            Domain.Entities.Intervention App = new Domain.Entities.Intervention()
            {
                Description = inter.myintervention.Description,
                idU         = u.Id
            };


            MyService.Add(App);
            MyService.Commit();



            return(RedirectToAction("DoctorProfile", "Calender"));
        }
示例#2
0
        public ActionResult DoctorProfile()
        {
            Models.Entities.User u = Getcurrentuser();

            SqlConnection conn = new SqlConnection("Data Source=(LocalDb)\\MSSQLLocalDB;Initial Catalog=EpionneDb;Persist Security Info=True;User ID=;Password="******"Data Source = ; AttachDbFilename =| DataDirectory |\aspnet - Epione.Presentation - 20181027124435.mdf; Initial Catalog = Epione; Integrated Security = True  providerName=System.Data.SqlClient");
            conn.Open();

            SqlCommand command = new SqlCommand("Select * from [Users] where id=@zip", conn);

            //SqlCommand command = new SqlCommand("Select id from [Users] where name=@zip", conn);
            command.Parameters.AddWithValue("@zip", u.Id);

            Doctor D = new Models.Entities.Doctor();

            using (SqlDataReader reader = command.ExecuteReader())
            {
                while (reader.Read())

                {
                    int    Id   = Int32.Parse(String.Format("{0}", reader["Id"]));
                    string name = String.Format("{0}", reader["firstName"]);

                    string Adress    = String.Format("{0}", reader["Address"]);
                    string Email     = String.Format("{0}", reader["Email"]);
                    string Lname     = String.Format("{0}", reader["lastName"]);
                    string imagePath = String.Format("{0}", reader["imagePath"]);

                    D = new Doctor {
                        Id = Id, firstName = name, Address = Adress, Email = Email, lastName = Lname, imagePath = imagePath
                    };
                }

                reader.NextResult();
            }


            conn.Close();



            conn.Open();
            List <Intervention> Linter = new List <Intervention>();

            SqlCommand command2 = new SqlCommand("Select * from [Interventions] where idU=@zip", conn);

            //SqlCommand command = new SqlCommand("Select id from [Users] where name=@zip", conn);
            command2.Parameters.AddWithValue("@zip", u.Id);

            using (SqlDataReader reader = command2.ExecuteReader())
            {
                while (reader.Read())

                {
                    int    Id   = Int32.Parse(String.Format("{0}", reader["interventionId"]));
                    string name = String.Format("{0}", reader["Description"]);

                    Intervention Int = new Intervention {
                        Description = name, interventionId = Id
                    };
                    Linter.Add(Int);
                }

                reader.NextResult();
            }


            conn.Close();

            allahmed ahmed = new allahmed {
                mydoctor = D, interventionList = Linter
            };


            return(View(ahmed));
        }