Esempio n. 1
0
        public bool AddDoctor(Doctor doctor)
        {
            try
            {
                doctor.ID = Guid.NewGuid();
                db.Insert(doctor);

            }
            catch (Exception)
            {

                return false;
            }
            return true;
        }
Esempio n. 2
0
        public bool UpdateDoctor(Guid ID, Doctor doctor)
        {
            try
            {               
                db.Update(doctor);

            }
            catch (Exception)
            {

                return false;
            }
            return true;

        }
Esempio n. 3
0
 public bool Delete(Doctor doctor)
 {
     throw new NotImplementedException();
 }
Esempio n. 4
0
 public bool Insert(Doctor doctor)
 {
     throw new NotImplementedException();
 }
Esempio n. 5
0
        public bool Delete(Doctor doctor)
        {
            string sqlQuery = "Delete from [dbo].[doctors] where [id] = @ID";
            var result = false;
            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();

                conn.Execute(sqlQuery,
                new
                {
                    doctor.ID,

                });
                result = true;
            }
            return result;
        }
Esempio n. 6
0
        public bool Update(Doctor doctor)
        {
            string sqlQuery = "Update [dbo].[doctors] set [name] = @Name where [id] = @ID";
            var result = false;
            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();

                conn.Execute(sqlQuery,
                new
                {
                    doctor.ID,
                    doctor.Name
                });
                result = true;
            }
            return result;
        }
Esempio n. 7
0
        public bool Insert(Doctor doctor)
        {
            string sqlQuery = "INSERT INTO [dbo].[doctors]([id],[name]) VALUES (@ID,@Name)";
            var result = false;
            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();

                conn.Execute(sqlQuery,
                new
                {
                    doctor.ID,
                    doctor.Name
                });
                result = true;
            }
            return result;
        }