예제 #1
0
 //Get Product detail from database
 public TblProducts GetProductData(int id)
 {
     try
     {
         long        id_long     = Convert.ToInt64(id);
         TblProducts Tbl_pro_obj = db_con.TblProducts.Find(id_long);
         return(Tbl_pro_obj);
     }
     catch
     {
         throw;
     }
 }
예제 #2
0
        //Product Update..
        public int Product_Update(TblProducts Tbl_pro_obj)
        {
            try
            {
                db_con.Entry(Tbl_pro_obj).State = EntityState.Modified;
                db_con.SaveChanges();

                return(1);
            }
            catch
            {
                throw;
            }
        }
예제 #3
0
        //Add New Product Detail To DataBase
        public int AddProduct(TblProducts Tbl_pro_obj)
        {
            try
            {
                db_con.TblProducts.Add(Tbl_pro_obj);
                db_con.SaveChanges();

                return(1);
            }
            catch
            {
                throw;
            }
        }
예제 #4
0
 //To Delete selected product
 public int Del_Product(int id)
 {
     try
     {
         long        idof_product = Convert.ToInt64(id);
         TblProducts emp          = db_con.TblProducts.Find(idof_product);
         db_con.TblProducts.Remove(emp);
         db_con.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }