コード例 #1
0
        // Get: Item/Create
        public ActionResult Create()
        {
            var userId        = User.Identity.GetUserId();
            var subCatService = new SubCatService(userId);

            var sortedCatSubCatList = new SelectList(subCatService.GetCatSubCats(), "SubCatId", "CatSubCatName");
            var sortedCatagoryList  = sortedCatSubCatList.OrderBy(o => o.Value);

            ViewBag.SubCatId = sortedCatSubCatList;

            return(View());
        }
コード例 #2
0
        // GET: Item/Update
        public ActionResult Edit(int id)
        {
            var service = CreateItemService();
            var detail  = service.GetItemById(id);
            var model   =
                new ItemUpdate
            {
                ItemId      = detail.ItemId,
                SubCatId    = detail.SubCatId,
                ItemName    = detail.ItemName,
                AisleNumber = detail.AisleNumber,
                MaxAllowed  = detail.MaxAllowed,
                PointCost   = detail.PointCost
            };

            var userId        = User.Identity.GetUserId();
            var subCatService = new SubCatService(userId);

            var sortedCatSubCatList = new SelectList(subCatService.GetCatSubCats(), "SubCatId", "CatSubCatName", model.SubCatId);
            var sortedCatagoryList  = sortedCatSubCatList.OrderBy(o => o.Text);

            ViewBag.SubCatId = sortedCatSubCatList;
            return(View(model));
        }