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

            }
            catch (Exception)
            {

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

            }
            catch (Exception)
            {

                return false;
            }
            return true;

        }
Beispiel #3
0
 public bool Delete(Doctor doctor)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
 public bool Insert(Doctor doctor)
 {
     throw new NotImplementedException();
 }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #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;
        }