Esempio n. 1
0
 public override string ToString()
 {
     using (var contex = new CookingBookEntities1())
     {
         return(Title + " / " + contex.Authors.Where(x => x.ID == AuthorID).FirstOrDefault().Name);
     }
 }
Esempio n. 2
0
        public override string ToString()
        {
            using (var contex = new CookingBookEntities1())
            {
                quantityTypeVariant = contex.QuantityTypes.Where(x => x.ID == TypeID).FirstOrDefault().Name;
                if (Quantity != 1)
                {
                    if ((Quantity < 1 || (Quantity < 10 || Quantity > 20) && Quantity % 10 > 1 && Quantity % 10 < 5) && (quantityTypeVariant == "Szklanka" || quantityTypeVariant == "Sztuka" || quantityTypeVariant == "£y¿eczka" || quantityTypeVariant == "£y¿ka"))
                    {
                        quantityTypeVariant  = quantityTypeVariant.Remove(quantityTypeVariant.Length - 1);
                        quantityTypeVariant += "i";
                    }

                    if (Quantity > 1 && (Quantity % 10 < 2 || Quantity % 10 > 5 || (Quantity < 10 || Quantity > 20)) && (quantityTypeVariant == "Szklanka" || quantityTypeVariant == "Sztuka" || quantityTypeVariant == "£y¿eczka" || quantityTypeVariant == "£y¿ka"))
                    {
                        if (quantityTypeVariant == "Sztuka")
                        {
                            quantityTypeVariant = quantityTypeVariant.Remove(quantityTypeVariant.Length - 1);
                        }
                        else
                        {
                            quantityTypeVariant  = quantityTypeVariant.Remove(quantityTypeVariant.Length - 2);
                            quantityTypeVariant += "ek";
                        }
                    }
                }
                return(Name + ", " + Quantity + " " + quantityTypeVariant);
            }
        }