// GET: Project/Create
        public ActionResult Create()
        {   //create a List of objects through calling your service
            //Store that List in a Viewbag as one of 3-4 parameters of a SelectList object
            //@Html.DropDownList() in your view

            var cpuDb = new CPUService();

            ViewBag.CpuId = new SelectList(cpuDb.GetAllCPUs().ToList(), "CpuId", "Name");


            var memDb = new MemoryService();

            ViewBag.MemoryId = new SelectList(memDb.GetAllMemories().ToList(), "MemoryId", "Name");

            var caseDb = new CaseService();

            ViewBag.CaseId = new SelectList(caseDb.GetAllCases().ToList(), "CaseId", "Name");

            var videoDb = new VideoCardService();

            ViewBag.VideoId = new SelectList(videoDb.GetAllVideoCards().ToList(), "VideoId", "Name");

            var mobaDb = new MOBAService();

            ViewBag.MotherboardId = new SelectList(mobaDb.GetAllMOBAs().ToList(), "MotherboardId", "Name");

            var psuDb = new PSUService();

            ViewBag.PsuId = new SelectList(psuDb.GetAllPowerSupplyUnits().ToList(), "PsuId", "Name");

            return(View());
        }
Exemplo n.º 2
0
        // GET: Memory
        public ActionResult Index()
        {
            var service = new MemoryService();
            var memList = service.GetAllMemories();

            return(View(memList));
        }
        public IActionResult Index()
        {
            var viewModel = service.GetAllMemories();

            //var createdAccountSuccess = (string)TempData["Message"];

            return(View(viewModel));
        }
        // GET: Project/Edit/5
        public ActionResult Edit(int id)
        {
            var cpuDb = new CPUService();

            ViewBag.CpuId = new SelectList(cpuDb.GetAllCPUs().ToList(), "CpuId", "Name");


            var memDb = new MemoryService();

            ViewBag.MemoryId = new SelectList(memDb.GetAllMemories().ToList(), "MemoryId", "Name");

            var caseDb = new CaseService();

            ViewBag.CaseId = new SelectList(caseDb.GetAllCases().ToList(), "CaseId", "Name");

            var videoDb = new VideoCardService();

            ViewBag.VideoId = new SelectList(videoDb.GetAllVideoCards().ToList(), "VideoId", "Name");

            var mobaDb = new MOBAService();

            ViewBag.MotherboardId = new SelectList(mobaDb.GetAllMOBAs().ToList(), "MotherboardId", "Name");

            var psuDb = new PSUService();

            ViewBag.PsuId = new SelectList(psuDb.GetAllPowerSupplyUnits().ToList(), "PsuId", "Name");


            var service = new ProjectService();
            var detail  = service.GetProjectById(id);
            var model   = new ProjectEdit
            {
                ProjectId       = detail.ProjectId,
                Name            = detail.Name,
                Description     = detail.Description,
                Notes           = detail.Notes,
                CpuId           = detail.CpuId,
                CPU             = detail.CPU,
                MemoryId        = detail.MemoryId,
                Memory          = detail.Memory,
                CaseId          = detail.CaseId,
                Case            = detail.Case,
                VideoId         = detail.VideoId,
                VideoCard       = detail.VideoCard,
                MotherboardId   = detail.MotherboardId,
                Motherboard     = detail.Motherboard,
                PsuId           = detail.PsuId,
                PowerSupplyUnit = detail.PowerSupplyUnit
            };

            return(View(model));
        }