Exemplo n.º 1
0
        // GET : CPU/Details/{id}
        public ActionResult Details(int id)
        {
            var service = new CPUService();
            var model   = service.GetCpuById(id);

            return(View(model));
        }
        // 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.º 3
0
        // GET: CPU
        public ActionResult Index()
        {
            var service = new CPUService();
            var cpuList = service.GetAllCPUs();

            return(View(cpuList));
        }
Exemplo n.º 4
0
        public ActionResult DeleteCPU(int id)
        {
            var service = new CPUService();

            service.DeleteCpu(id);

            TempData["SaveResult"] = "Your CPU entry was deleted.";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
        public ActionResult Create(CPUCreate cpu)
        {
            var service = new CPUService();

            if (ModelState.IsValid)
            {
                service.CreateCPU(cpu);
                return(RedirectToAction("Index"));
            }
            return(View(cpu));
        }
Exemplo n.º 6
0
        // GET : CPU/Delete/{id}
        public ActionResult Delete(int id)
        {
            var service = new CPUService();
            var model   = service.GetCpuById(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
        // 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));
        }
Exemplo n.º 8
0
        public ActionResult Edit(int id, CPUEdit model)
        {
            if (model.CpuId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = new CPUService();

            if (service.UpdateCpu(model))
            {
                TempData["SaveResult"] = "Your CPU information was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your CPU information could not be updated.");
            return(View());
        }
Exemplo n.º 9
0
        // GET : CPU/Edit/{id}
        public ActionResult Edit(int id)
        {
            var service = new CPUService();
            var detail  = service.GetCpuById(id);
            var model   = new CPUEdit
            {
                CpuId                      = detail.CpuId,
                Manufacturer               = detail.Manufacturer,
                Series                     = detail.Series,
                CoreFamily                 = detail.CoreFamily,
                Name                       = detail.Name,
                CoreCount                  = detail.CoreCount,
                CoreClock                  = detail.CoreClock,
                BoostClock                 = detail.BoostClock,
                Socket                     = detail.Socket,
                IsAvailable                = detail.IsAvailable,
                MicroArchitecture          = detail.MicroArchitecture,
                ThermalDesignPower         = detail.ThermalDesignPower,
                IntegratedGraphics         = detail.IntegratedGraphics,
                SimultaneousMultithreading = detail.SimultaneousMultithreading
            };

            return(View(model));
        }
Exemplo n.º 10
0
 public void startTest()
 {
     cpuTest = new CPUService();
 }
Exemplo n.º 11
0
 public void TestInitialize()
 {
     cpuService = new CPUService(uow.Object, CPUs.Object);
 }