public BookUpdateWindow(localhost.Book b)
        {
            InitializeComponent();

            this.IdToBeUpdated = b.Id;
            this.OldTitle = b.Title;
            this.OldCategory = b.Category;
            this.OldAuthor = b.Author;
            this.OldPhoto = b.Photo;
            this.OldPrice = b.Price;

            this.BookTitleTb.Text = this.OldTitle;
            this.BookCategoryTb.Text = this.OldCategory;
            this.BookAuthorTb.Text = this.OldAuthor;
            this.BookPriceTb.Text = this.OldPrice.ToString();
            this.BookDescriptionTb.Text = b.Description;
            if (this.OldPhoto!=null)
            {
                using (MemoryStream stream = new MemoryStream(this.OldPhoto))
                {
                    BookCoverPreviewImage.Source = BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
                }
            }

            if (this.BookTitleTb.Text != "" && this.BookCategoryTb.Text!= "")
            {
                this.IsValid = true;
            }
            else
            {
                this.IsValid = false;
            }
            openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "Images (.jpg, .png, .bmp)|*.jpg;*.bmp";
        }
示例#2
0
        // GET: Prueba
        public ActionResult Index()
        {
            localhost DBprueba = new localhost();

            return(View(DBprueba.usuarioset));
        }