// 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)); }
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()); } }
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()); } }
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 }); }