コード例 #1
0
        /// <summary>
        /// Tao moi 1 record
        /// </summary>
        /// <param name="lop"></param>
        /// <returns>-1 : Input rỗng</returns>
        /// <returns> 0 : Trùng</returns>
        /// <returns> 1 : Thành công</returns>
        /// <returns>2 : Exception</returns>
        public int Create(Lop lop)
        {
            if (lop == null)
            {
                return(-1);
            }
            LopDAO context = new LopDAO();

            try
            {
                LopBLL contextL = new LopBLL();
                lop.MaLop = contextL.CreateMaLop(lop.MaKhoa, lop.NienKhoa, lop.MaHDT);
                context.Create(lop);
                return(1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(2);
            }
        }