Ejemplo n.º 1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int id    = int.Parse(txtId.Text);
         var offer = _proxyOffer.FindServiceOffer(id);
         var u     = _proxyUser.FindUser(offer.AuthorId);
         //UserAppModel user = _mapper.Map(offer.Author, new UserAppModel());
         IList <ServiceAppModel> list = new List <ServiceAppModel>();
         list.Add(new ServiceAppModel
         {
             Id           = offer.Id,
             Author_phone = u.PhoneNumber,
             Category     = offer.Category,
             Description  = offer.Description,
             RatePerHour  = offer.RatePerHour,
             Subcategory  = offer.Subcategory,
             Title        = offer.Title,
             FullName     = u.FirstName + " " + u.LastName
         });
         servicesTable.ItemsSource = list;
     }
     catch (FormatException)
     {
         MessageBox.Show("ID needs to be positive ", "Can't find ID");
     }
     catch (ArgumentNullException)
     {
         MessageBox.Show("Enter user's Id first", "Empty field");
     }
 }