public ActionResult Index(AsppDevice device)
        {
            bool statement = false;

            if (ModelState.IsValid || ModelState.IsValidField("DevAsppGenId") == false)
            {
                statement = _deviceBaseService.AsppDeviceRepository.SaveDevice(device, User.Identity.Name);
            }
            if (statement)
            {
                AsppDeviceViewModel deviceViewModel = new AsppDeviceViewModel();
                deviceViewModel.Device = _deviceBaseService.AsppDeviceRepository.GetDeviceById(device.DevAsppGenId.ToString());

                return(RedirectToAction("Index", new { deviceid = deviceViewModel.Device.DevAsppGenId }));
            }
            else
            {
                return(HttpNotFound());
            }
        }
        public ActionResult Index(string deviceid = "")
        {
            AsppDeviceViewModel device = new AsppDeviceViewModel();

            if (String.IsNullOrWhiteSpace(deviceid))
            {
                device.Locations   = new SelectList(_deviceBaseService.LocationRepository.GetLocations(), "LocationName", "LocationName");
                device.DeviceClass = new SelectList(_deviceBaseService.DeviceClassRepository.GetDeviceClassesByDepartment("АСПП"), "DeviceClassName", "DeviceClassName");
                return(View(device));
            }
            device.Device      = _deviceBaseService.AsppDeviceRepository.GetDeviceById(deviceid);
            device.Log         = _deviceBaseService.AsppDeviceRepository.GetLogById(deviceid);
            device.Locations   = new SelectList(_deviceBaseService.LocationRepository.GetLocations(), "LocationName", "LocationName");
            device.DeviceClass = new SelectList(_deviceBaseService.DeviceClassRepository.GetDeviceClassesByDepartment("АСПП"), "DeviceClassName", "DeviceClassName");
            device.DeviceType  = new SelectList(_deviceBaseService.DeviceTypeRepository.GetDeviceTypesByDeviceClass(device.Device.DeviceClass), "DeviceTypeName", "DeviceTypeName");

            if (device.Device == null)
            {
                return(HttpNotFound());
            }
            return(View(device));
        }