public async Task <ActionResult> UpdateSoftwareType(SoftwareType swType)
        {
            ModelState.Remove(nameof(swType.Id));
            ModelState.Remove(nameof(swType.Created));
            ModelState.Remove(nameof(swType.LastChange));
            ModelState.Remove(nameof(swType.ChangedBy));
            if (ModelState.IsValid)
            {
                var userRepository = new ApplicationUserRepository <Admin>();
                var swTypeRepo     = new SoftwareTypeRepository();
                var currentUser    = userRepository.GetByUserNameAsync(User.Identity.Name);

                swType.LastChange = DateTime.Now;
                swType.ChangedBy  = await currentUser;

                swTypeRepo.Update(swType);
                TempData["success"] = "Software type was edited";
            }
            else
            {
                return(View("EditSoftwareType", swType));
            }

            return(RedirectToAction("SoftwareTypes"));
        }
        public ActionResult ToggleValidSoftwareType(IList <SoftwareType> rows)
        {
            var swTypeRepo = new SoftwareTypeRepository();

            foreach (var row in rows)
            {
                var swType = swTypeRepo.GetById(row.Id);

                if (swType.Valid)
                {
                    swType.Valid = false;
                }
                else if (!swType.Valid)
                {
                    swType.Valid = true;
                }

                swTypeRepo.Update(swType);
            }

            TempData["success"] = "Software type/s was updated!";

            return(View("SoftwareTypes"));
        }