Ejemplo n.º 1
0
        public Result <bool> insert_mon(Mon_ett mon)
        {
            Result <bool> rs = new Result <bool>();

            try
            {
                // create new tbl_khoa to insert to datacontext
                tbl_mon temp = new tbl_mon();
                temp.mamon  = mon.mamon;
                temp.tenmon = mon.tenmon;

                // remember : linq insert data
                db.tbl_mons.InsertOnSubmit(temp);
                // remember : all manipulations such as insert, update, delete have to use this command
                db.SubmitChanges();

                rs.data      = true;
                rs.errorCode = ErrorCode.Sucess;
                return(rs);
            }
            catch (Exception e)
            {
                rs.data       = false;
                rs.errorCode  = ErrorCode.False;
                rs.errorInfor = e.ToString();
                return(rs);
            }
        }
Ejemplo n.º 2
0
 public Mon_ett(tbl_mon mon)
 {
     mamon = mon.mamon;
     tenmon = mon.tenmon;
 }
Ejemplo n.º 3
0
 public Mon_ett(tbl_mon mon)
 {
     mamon  = mon.mamon;
     tenmon = mon.tenmon;
 }
        public Result<bool> insert_mon(Mon_ett mon)
        {
            Result<bool> rs = new Result<bool>();
            try
            {
                // create new tbl_khoa to insert to datacontext
                tbl_mon temp = new tbl_mon();
                temp.mamon = mon.mamon;
                temp.tenmon = mon.tenmon;

                // remember : linq insert data
                db.tbl_mons.InsertOnSubmit(temp);
                // remember : all manipulations such as insert, update, delete have to use this command
                db.SubmitChanges();

                rs.data = true;
                rs.errorCode = ErrorCode.Sucess;
                return rs;
            }
            catch (Exception e)
            {
                rs.data = false;
                rs.errorCode = ErrorCode.False;
                rs.errorInfor = e.ToString();
                return rs;
            }
        }