public bool UpdateSupplier(TB_M_Suppliers supplier)
        {
            Console.Write("Insert your Id : ");
            int Id  = Convert.ToInt16(Console.ReadLine());
            var get = myContext.TB_M_Suppliers.Find(Id);

            if (get != null)
            {
                Console.Write("Insert Your Name :");
                string Name = Console.ReadLine();
                get.Name = Name;
                myContext.Entry(get).State = EntityState.Modified;
                var result = (myContext.SaveChanges());
                if (result > 0)
                {
                    Console.Write("Update Succes");
                    status = true;
                }
                else
                {
                    Console.Write("Update Failed");
                }
            }
            else
            {
                Console.Write("Data Not Found");
            }
            return(status);
        }
Ejemplo n.º 2
0
        public bool InsertData()
        {
            string Name;

            Console.Write("Insert TB_M_Suppliers name : ");
            Name = Console.ReadLine();
            TB_M_Suppliers TB_M_Suppliers = new TB_M_Suppliers();

            TB_M_Suppliers.Name = Name;
            myContext.TB_M_Suppliers.Add(TB_M_Suppliers);
            return(Save(myContext));
        }
        public bool InsertSupplier(TB_M_Suppliers supplier)
        {
            Console.Write("Insert your name : ");
            string Name = Console.ReadLine();

            supplier.Name = Name;
            myContext.TB_M_Suppliers.Add(supplier);
            var result = (myContext.SaveChanges());

            if (result > 0)
            {
                status = true;
                Console.Write("Insert Successfully");
            }
            else
            {
                Console.Write("Insert Failed");
            }
            return(status);
        }
 public bool UpdateSupplier(int Id, TB_M_Suppliers supplier)
 {
     throw new NotImplementedException();
 }