コード例 #1
0
        public ActionResult Gpu(int computerId, int selectedGpu)
        {
            var cr  = new ComputerRepo(new ComputerMssql());
            var gr  = new GpuRepo(new GpuMssql());
            var gvm = new GpuViewModel(cr.GetById(computerId), gr.GetAll(), selectedGpu);

            return(View(gvm));
        }
コード例 #2
0
        public ActionResult Memory(int computerId)
        {
            var cr  = new ComputerRepo(new ComputerMssql());
            var mr  = new MemoryRepo(new MemoryMssql());
            var mvm = new MemoryViewModel(cr.GetById(computerId), mr.GetAll());

            return(View(mvm));
        }
コード例 #3
0
        public ActionResult Storage(int computerId)
        {
            var cr  = new ComputerRepo(new ComputerMssql());
            var mr  = new StorageRepo(new StorageMssql());
            var svm = new StorageViewModel(cr.GetById(computerId), mr.GetAll());

            return(View(svm));
        }
コード例 #4
0
        // GET: Part
        public ActionResult Cpu(int computerId)
        {
            var cr  = new ComputerRepo(new ComputerMssql());
            var cp  = new CpuRepo(new CpuMssql());
            var cvm = new CpuViewModel(cr.GetById(computerId), cp.GetAll());

            return(View(cvm));
        }
コード例 #5
0
        public ActionResult Motherboard(int computerId)
        {
            var cr  = new ComputerRepo(new ComputerMssql());
            var mb  = new MotherboardRepo(new MotherboardMssql());
            var mvm = new MotherboardViewModel(cr.GetById(computerId), mb.GetAll());

            return(View(mvm));
        }
コード例 #6
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 }));
        }
コード例 #7
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 }));
        }
コード例 #8
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 }));
        }
コード例 #9
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 }));
        }
コード例 #10
0
ファイル: User.cs プロジェクト: dandeman111/PcPartPicker
        //constructor
        public User(string username, string password, string email, List <int> computers)
        {
            Computers = new List <Computer>();
            var cr = new ComputerRepo(new ComputerMssql());

            Username = username;
            Password = password;
            Email    = email;
            foreach (var x in computers)
            {
                Computers.Add(cr.GetById(x));
            }
        }
コード例 #11
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 }));
        }
コード例 #12
0
        public ActionResult EditBuild(int computerId)
        {
            var computer = new ComputerRepo(new ComputerMssql());

            return(View(computer.GetById(computerId)));
        }