Exemplo n.º 1
0
        /* call stored procedure LINQ */

        public static void SelectHotels()
        {
            LinqToSQLDataContext db = new LinqToSQLDataContext();

            var hotels = db.spSelectHotel(2);

            Console.WriteLine(hotels.ElementAt(0).HotelName);
        }
Exemplo n.º 2
0
        /* select customer function equals to first name */
        public static void SelectCustomers(string Firstname)
        {
            LinqToSQLDataContext db = new LinqToSQLDataContext();

            CustomerData customer = db.CustomerDatas.FirstOrDefault(e => e.FirstName.Equals(Firstname));

            Console.WriteLine(customer.CustomerId + " " + customer.FirstName + " " + customer.LastName + " " + customer.PhoneNumber);
        }
Exemplo n.º 3
0
        /* update customer details */
        public static void UpdateCustomer()
        {
            LinqToSQLDataContext db = new LinqToSQLDataContext();

            CustomerData customer = db.CustomerDatas.FirstOrDefault(c => c.FirstName.Equals("xyz"));

            customer.FirstName = "pqr";

            db.SubmitChanges();
        }
Exemplo n.º 4
0
        /* insert customer function */
        public static void InsertCustomer(string customerFirstName, string customerLastName, string customerEmailId, string customerPhoneNumber)
        {
            LinqToSQLDataContext db = new LinqToSQLDataContext();

            CustomerData customer = new CustomerData();

            customer.FirstName   = customerFirstName;
            customer.LastName    = customerLastName;
            customer.EmailId     = customerEmailId;
            customer.PhoneNumber = customerPhoneNumber;

            db.CustomerDatas.InsertOnSubmit(customer);

            db.SubmitChanges();
        }