public bool UpdateWorkByWorkId(TeachingWorkModel updWork)
        {
            using (var db = new NpgsqlConnection(connectionString))
            {
                string sqlCheck = "SELECT id FROM public.teaching_work " +
                                  "WHERE id = @ID";
                string sql = "UPDATE public.teaching_work " +
                             "SET teaching_plan=@TPL " +
                             "WHERE  id = @ID";

                db.Open();

                if (db.Query <string>(sqlCheck, new { ID = updWork.Id }).FirstOrDefault() == null)
                {
                    return(false);
                }

                db.Execute(sql, new
                {
                    TPL = updWork.TeachingPlan,
                    ID  = updWork.Id
                });

                return(true);
            }
        }
        public bool AddWork(TeachingWorkModel work)
        {
            using (var db = new NpgsqlConnection(connectionString))
            {
                string sql = "INSERT INTO public.teaching_work(teaching_plan, teacher_id) " +
                             "VALUES (@TPL, @TID)";
                string sqlCheck = "SELECT id FROM public.lecturer " +
                                  "WHERE lecturer_id = @ID";

                db.Open();

                if (db.Query <string>(sqlCheck, new { ID = work.Id }).FirstOrDefault() == null)
                {
                    return(false);
                }

                db.Execute(sql, new {
                    TPL = work.TeachingPlan,
                    TID = work.TeacherId
                });

                return(true);
            }
        }