Esempio n. 1
0
        // GET: RAM
        public ActionResult Index()
        {
            dtbs15Entities db = new dtbs15Entities();

            var ca = db.RAMs.ToList();
            List <RamViewModel> bc = new List <RamViewModel>();

            foreach (var c in ca)
            {
                RamViewModel b = new RamViewModel();

                b.id       = c.Id;
                b.Capacity = c.Capacity;
                bc.Add(b);
            }
            return(View(bc));
        }
Esempio n. 2
0
        public ActionResult Edit(int id, RamViewModel collection)
        {
            try
            {
                // TODO: Add update logic here

                dtbs15Entities db = new dtbs15Entities();
                RAM            bc = new RAM();
                var            c  = db.RAMs.Where(x => x.Id == id).SingleOrDefault();
                c.Capacity = collection.Capacity;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 3
0
        public ActionResult Create(RamViewModel collection)
        {
            try
            {
                // TODO: Add insert logic here

                dtbs15Entities db = new dtbs15Entities();
                RAM            bc = new RAM();
                bc.Capacity = collection.Capacity;
                db.RAMs.Add(bc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 4
0
        private DashboardViewModel GetDashboardViewModel()
        {
            CpuViewModel cpuViewModel = new CpuViewModel
            {
                LogicalCpuCores  = _informationsService.GetLogicalCpuCores(),
                PhysicalCpuCores = _informationsService.GetPhysicalCpuCores(),
                CpuName          = _informationsService.GetCpuName(),
                CpuClockSpeed    = _informationsService.GetCpuClockSpeed(),
                CpuUsage         = _informationsService.GetCpuUsage()
            };

            RamViewModel ramViewModel = new RamViewModel
            {
                UsedRam  = _informationsService.GetUsedRam(),
                TotalRam = _informationsService.GetTotalRam(),
                NamesRam = _informationsService.GetNamesRam()
            };

            DiskViewModel diskViewModel = new DiskViewModel
            {
                TotalDiskSpace = _informationsService.GetTotalDiskSpace(),
                UsedDiskSpace  = _informationsService.GetUsedDiskSpace(),
                NamesDisk      = _informationsService.GetNamesDisk(),
                DisksUsage     = _informationsService.GetDisksUsage()
            };

            UptimeViewModel uptimeViewModel = new UptimeViewModel
            {
                Uptime = _informationsService.GetUptime(),
                OS     = _informationsService.GetOs()
            };

            return(new DashboardViewModel
            {
                CpuViewModel = cpuViewModel,
                RamViewModel = ramViewModel,
                DiskViewModel = diskViewModel,
                UptimeViewModel = uptimeViewModel
            });
        }