コード例 #1
0
        public ActionResult EditStorage(int computerId, int storageId)
        {
            var cr       = new ComputerRepo(new ComputerMssql());
            var sr       = new StorageRepo(new StorageMssql());
            var editedPc = cr.GetById(computerId);

            editedPc.Storage = sr.GetById(storageId);
            cr.Update(editedPc);
            return(RedirectToAction("EditBuild", "Build", new { computerId }));
        }
コード例 #2
0
        public ActionResult EditMotherBoard(int computerId, int motherboardId)
        {
            var cr       = new ComputerRepo(new ComputerMssql());
            var mb       = new MotherboardRepo(new MotherboardMssql());
            var editedPc = cr.GetById(computerId);

            editedPc.Motherboard = mb.GetById(motherboardId);
            cr.Update(editedPc);
            return(RedirectToAction("EditBuild", "Build", new { computerId }));
        }
コード例 #3
0
        public ActionResult EditMemory(int computerId, int memoryId)
        {
            var cr       = new ComputerRepo(new ComputerMssql());
            var mr       = new MemoryRepo(new MemoryMssql());
            var editedPc = cr.GetById(computerId);

            editedPc.Memory = mr.GetById(memoryId);
            cr.Update(editedPc);
            return(RedirectToAction("EditBuild", "Build", new { computerId }));
        }
コード例 #4
0
        public ActionResult EditCpu(int computerId, int cpuId)
        {
            var cr       = new ComputerRepo(new ComputerMssql());
            var cp       = new CpuRepo(new CpuMssql());
            var editedPc = cr.GetById(computerId);

            editedPc.Cpu = cp.GetById(cpuId);
            cr.Update(editedPc);
            return(RedirectToAction("EditBuild", "Build", new { computerId }));
        }
コード例 #5
0
        public ActionResult EditGpu(int computerId, int gpuId, int currentGpu)
        {
            var cr       = new ComputerRepo(new ComputerMssql());
            var gr       = new GpuRepo(new GpuMssql());
            var editedPc = cr.GetById(computerId);

            for (var i = 0; i < editedPc.Gpus.Count; i++)
            {
                if (editedPc.Gpus[i].GpuId == currentGpu)
                {
                    editedPc.Gpus[i] = gr.GetById(gpuId);
                }
            }
            cr.Update(editedPc);
            return(RedirectToAction("EditBuild", "Build", new { computerId }));
        }