Exemplo n.º 1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            BookLetViewModel book = new BookLetViewModel();

            book = bookLetServices.GetBookLetById(id);
            if (book == null)
            {
                return(NotFound());
            }
            List <SelectListItem> activity = new List <SelectListItem>();

            activity.Add(new SelectListItem {
                Text = "Commerical", Value = "0"
            });
            activity.Add(new SelectListItem {
                Text = "Agriculture", Value = "1"
            });
            activity.Add(new SelectListItem {
                Text = "Other", Value = "2"
            });
            ViewBag.activity = new SelectList(activity, "Value", "Text", book.Activity);

            return(View(book));
        }
Exemplo n.º 2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            BookLetSalesViewModel bookLetSale = new BookLetSalesViewModel();

            bookLetSale = bookLetSaleServices.GetBookLetSaleById(id);
            if (bookLetSale == null)
            {
                return(NotFound());
            }
            List <BookLetViewModel> allBookAvailableIncludeCurrent = bookLetSaleServices.GetAllBookLetAvaliable();
            BookLetViewModel        book = bookLetServices.GetBookLetById(bookLetSale.BookLetId);

            allBookAvailableIncludeCurrent.Add(book);
            ViewBag.bookList = new SelectList(allBookAvailableIncludeCurrent.OrderBy(x => x.Id), "Id", "Id", book);
            return(View(bookLetSale));
        }