12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using LearnPodg.DataBase;
- using System.Linq;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media.Imaging;
- namespace LearnPodg
- {
- /// <summary>
- /// Логика взаимодействия для AddingEditingService.xaml
- /// </summary>
- public partial class AddingEditingService : UserControl
- {
- public AddingEditingService()
- {
- InitializeComponent();
- UCLabel.Text = "Добавление сервиса";
- GBID.Visibility = Visibility.Collapsed;
- }
- public AddingEditingService(int serviceID)
- {
- InitializeComponent();
- UCLabel.Text = "Редактирование сервиса";
- GBID.Visibility = Visibility.Visible;
- Service service;
- using (Entities db = new Entities()) service = db.Service.Where(a => a.ID == serviceID).First();
- TBTitle.Text = service.Title;
- TBDiscription.Text = service.Description;
- TBCost.Text = service.Cost.ToString();
- TBDiscount.Text = service.Discount.ToString();
- TBDurationInSecond.Text = service.DurationInSeconds.ToString();
- TBID.Text = service.ID.ToString();
- BitmapImage bitmapImage = new BitmapImage();
- bitmapImage.BeginInit();
- bitmapImage.UriSource = new System.Uri(service.Image.Trim(), System.UriKind.RelativeOrAbsolute);
- bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
- bitmapImage.EndInit();
- ServiceImage.Source = bitmapImage;
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- MainWindow.contentControl.Content = new ServicesList();
- }
- }
- }
|