protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService"); int ID = (int)e.Keys["restaurantId"]; RestaurantServiceReference.Restaurant res = new RestaurantServiceReference.Restaurant(); string name = (string)e.NewValues["name"]; string city = (string)e.NewValues["city"]; string description = (string)e.NewValues["description"]; string food_type = (string)e.NewValues["food_type"]; string contactno = (string)e.NewValues["contactno"]; res.RestaurantId = ID; res.Name = name; res.City = city; res.Description = description; res.FoodType = food_type; res.ContactNo = contactno; client.UpdateRestaurant(res); GridView1.EditIndex = -1; lblStatus.Text = "Restaurant Updated Successfully..."; lblStatus.ForeColor = System.Drawing.Color.Green; BindData(); }
protected void Btn_Add_Restaurant_Click(object sender, EventArgs e) { RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService"); RestaurantServiceReference.Restaurant res = new RestaurantServiceReference.Restaurant(); res.FoodType = txtFoodType.Text; res.Description = txtDescription.Text; res.City = txtCity.Text; res.Name = txtName.Text; res.ContactNo = txtContactNo.Text; client.AddRestaurant(res); lblStatus.Text = "Restaurant Added Successfully..."; lblStatus.ForeColor = System.Drawing.Color.Green; }