public async Task <IActionResult> Update(AssetsDTO assetsDTO)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(assetsDTO));
                }

                StatusModel       statusModel       = (StatusModel)Enum.Parse(typeof(StatusModel), assetsDTO.Status);
                LocationModel     locationModel     = (LocationModel)Enum.Parse(typeof(LocationModel), assetsDTO.Location);
                TypeModel         typeModel         = (TypeModel)Enum.Parse(typeof(TypeModel), assetsDTO.Type);
                AvailabilityModel availabilityModel = (AvailabilityModel)Enum.Parse(typeof(AvailabilityModel), assetsDTO.IsAvailable);
                AvailabilityModel assigned          = (AvailabilityModel)Enum.Parse(typeof(AvailabilityModel), assetsDTO.IsAssinged);

                assetsDTO.Status      = statusModel.ToString();
                assetsDTO.Location    = locationModel.ToString();
                assetsDTO.Type        = typeModel.ToString();
                assetsDTO.IsAvailable = availabilityModel.ToString();
                assetsDTO.IsAssinged  = assetsDTO.ToString();

                var asset = new Asset()
                {
                    Id          = assetsDTO.Id,
                    Brand       = assetsDTO.Brand,
                    HostName    = assetsDTO.HostName,
                    AssetNo     = assetsDTO.AssetNo,
                    ExpressCode = assetsDTO.ExpressCode,
                    IsAvailable = availabilityModel.ToString(),
                    Location    = locationModel.ToString(),
                    Status      = statusModel.ToString(),
                    Model       = assetsDTO.Model,
                    Remarks     = assetsDTO.Remarks,
                    SerialNo    = assetsDTO.SerialNo,
                    Type        = typeModel.ToString(),
                    IsAssinged  = assigned.ToString()
                };

                var result = await _assetInterface.EditAsset(asset, Request.Cookies["AssetReference"].ToString());

                return(View(assetsDTO));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error encountered in AssetsController||Update ErrorMessage: {ex.Message}");
                return(RedirectToAction("Index", "Error"));
            }
        }
        public async Task <IActionResult> Update(UserStaffDTO userStaffDTO)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(userStaffDTO));
                }

                LocationModel     locationModel     = (LocationModel)Enum.Parse(typeof(LocationModel), userStaffDTO.Location);
                AvailabilityModel availabilityModel = (AvailabilityModel)Enum.Parse(typeof(AvailabilityModel), userStaffDTO.IsActive);

                var userStaff = new UserStaff()
                {
                    Id          = userStaffDTO.Id,
                    DisplayName = userStaffDTO.DisplayName,
                    Department  = userStaffDTO.Department,
                    Location    = locationModel.ToString(),
                    IsActive    = availabilityModel.ToString(),
                    DateCreated = userStaffDTO.DateCreated
                };

                var result = await _userStaffInterface.EditUserStaff(userStaff, Request.Cookies["AssetReference"].ToString());

                return(View(userStaffDTO));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error encountered in UserStaffsController||Update ErrorMessage: {ex.Message}");
                return(RedirectToAction("Index", "Error"));
            }
        }
        public async Task <IActionResult> Create(LicenseDTO licenseDTO)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(licenseDTO));
                }

                AvailabilityModel expiration        = (AvailabilityModel)Enum.Parse(typeof(AvailabilityModel), licenseDTO.Expiration);
                AvailabilityModel availabilityModel = (AvailabilityModel)Enum.Parse(typeof(AvailabilityModel), licenseDTO.IsAvailable);

                if (licenseDTO.Expiration.Equals("No"))
                {
                    licenseDTO.ExpiredOn = DateTime.MinValue;
                }

                var license = new License()
                {
                    ProductName    = licenseDTO.ProductName,
                    ProductVersion = licenseDTO.ProductVersion,
                    LicenseKey     = licenseDTO.LicenseKey,
                    Expiration     = expiration.ToString(),
                    ExpiredOn      = licenseDTO.ExpiredOn,
                    Remarks        = licenseDTO.Remarks,
                    IsAvailable    = availabilityModel.ToString(),
                    IsAssigned     = "No"
                };

                var result = await _licenseInterface.CreateLicense(license, Request.Cookies["AssetReference"].ToString());

                return(View(licenseDTO));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error encountered in LicenseController||Create ErrorMessage: {ex.Message}");
                return(RedirectToAction("Index", "Error"));
            }
        }