예제 #1
0
        public bool update_bo_phan(int id, string tenbp)
        {
            bophan bp = new bophan();

            bp.tenbp = tenbp;
            return(_Respo.Update_Bophan(id, bp));
        }
예제 #2
0
        public bool create_bo_phan(string tenbp)
        {
            bophan bp = new bophan();

            bp.tenbp = tenbp;
            return(_Respo.Create_Bophan(bp));
        }
 public bool Create_Bophan(bophan bp)
 {
     try
     {
         _context.bophans.Add(bp);
         _context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool Update_Bophan(int id, bophan bp)
 {
     try
     {
         bophan a = _context.bophans.SingleOrDefault(x => x.id == id);
         if (a != null)
         {
             a.tenbp = bp.tenbp;
         }
         _context.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool Delete_Bophan(int id)
 {
     try
     {
         bophan dp = _context.bophans.SingleOrDefault(x => x.id == id);
         if (dp != null)
         {
             _context.bophans.Remove(dp);
         }
         _context.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #6
0
        public JsonResult ht_qlphongban_them_sua(int type, bophan phong)
        {
            string[] namepara = { "@maphong", "@tenphong", "@dvquanly", "@madonvi" };
            if (phong.Dvquanly == null)
            {
                phong.Dvquanly = "";
            }
            object[] valuepara = { phong.Maphong, phong.Tenphong, phong.Dvquanly, phong.Madonvi };

            string result = string.Empty;

            switch (type)
            {
            case 1:
                if (dataAsset.data.inputdata("ht_qlphongban_them", namepara, valuepara))
                {
                    result = "1";
                }
                else
                {
                    result = "-1";
                }
                break;

            case 2:
                if (dataAsset.data.inputdata("ht_qlphongban_sua", namepara, valuepara))
                {
                    result = "1";
                }
                else
                {
                    result = "-1";
                }
                break;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public bophan Get_Bophan_Get_ID(int id)
        {
            bophan bp = _context.bophans.SingleOrDefault(x => x.id == id);

            return(bp);
        }