// GET: PieceInComputers/Create
 public ActionResult Create()
 {
     var vm = new PieceInComputerCreateEditViewModel();
     vm.ComputerSpecificationSelectList = new SelectList(_uow.ComputerSpecifications.All, nameof(ComputerSpecification.CompSpecId), nameof(ComputerSpecification.CompSpecId));
     vm.ProductSelectorSelectList = new SelectList(_uow.ProductSelectors.All, nameof(ProductSelector.ProductSelectorId), nameof(ProductSelector.FullName));
     return View(vm);
 }
        public ActionResult Create(PieceInComputerCreateEditViewModel vm)
        {
            if (ModelState.IsValid)
            {
                _uow.PieceInComputers.Add(vm.PieceInComputer);
                _uow.Commit();
                return RedirectToAction("Index");
            }

            vm.ComputerSpecificationSelectList = new SelectList(_uow.ComputerSpecifications.All, nameof(ComputerSpecification.CompSpecId), nameof(ComputerSpecification.CompSpecId), vm.PieceInComputer.CompSpecId);
            vm.ProductSelectorSelectList = new SelectList(_uow.ProductSelectors.All, nameof(ProductSelector.ProductSelectorId), nameof(ProductSelector.FullName), vm.PieceInComputer.ProductSelectorId);
            return View(vm);
        }
        // GET: PieceInComputers/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            PieceInComputer pieceInComputer = _uow.PieceInComputers.GetById(id);
            if (pieceInComputer == null)
            {
                return HttpNotFound();
            }
            var vm = new PieceInComputerCreateEditViewModel()
            {
                PieceInComputer = pieceInComputer
            };
            vm.ComputerSpecificationSelectList = new SelectList(_uow.ComputerSpecifications.All, nameof(ComputerSpecification.CompSpecId), nameof(ComputerSpecification.CompSpecId), vm.PieceInComputer.CompSpecId);
            vm.ProductSelectorSelectList = new SelectList(_uow.ProductSelectors.All, nameof(ProductSelector.ProductSelectorId), nameof(ProductSelector.FullName), vm.PieceInComputer.ProductSelectorId);

            return View(vm);
        }