示例#1
0
        public ActionResult Edit([Bind(Include = "Id,OrderDate,ReceptionDate,ReturnDate,UserId,BookId")] Order order)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _repo.Actualize(order);
                    _repo.SaveChanges();
                }
                catch
                {
                    ViewBag.Error = true;
                    return(View(order));
                }
            }
            ViewBag.BookId = new SelectList(_context.Book, "Id", "Title", order.BookId);
            ViewBag.UserId = new SelectList(_context.User, "Id", "Email", order.UserId);

            ViewBag.Error = false;
            return(View(order));
        }