Esempio n. 1
0
 public int CreateSoftwareAssetTypes(AssetManager_Software_AssetType softwareType)
 {
     //TODO: CHANGE WHEN BUILD CATEGORY TABLE
     softwareType.CategoryCode = 0;
     _context.AssetManager_Software_AssetType.Add(softwareType);
     _context.SaveChanges();
     return(softwareType.Id);
 }
        private AssetManager_Software_AssetType mapViewModelToEntitySoftwareType(
            AssetManager_SoftwareType_vm VMSoftwareType)
        {
            var models = new AssetManager_Software_AssetType
            {
                Id               = VMSoftwareType.Id,
                Name             = VMSoftwareType.Name,
                EndOfLifeMo      = VMSoftwareType.EndOfLifeMo,
                CategoryCode     = VMSoftwareType.CategoryCode,
                DescriptionNotes = VMSoftwareType.DescriptionNotes
            };

            return(models);
        }
        private AssetManager_SoftwareType_vm mapEntityToViewSoftwareType(
            AssetManager_Software_AssetType EFSoftwareType)
        {
            _logger.Debug("Mapping Entity to Software Asset Type View Model.");
            var vmST = new AssetManager_SoftwareType_vm
            {
                Id               = EFSoftwareType.Id,
                Name             = EFSoftwareType.Name,
                EndOfLifeMo      = EFSoftwareType.EndOfLifeMo,
                CategoryCode     = EFSoftwareType.CategoryCode,
                DescriptionNotes = EFSoftwareType.DescriptionNotes
            };

            return(vmST);
        }
Esempio n. 4
0
        public bool DeleteSoftwareAssetTypes(int id)
        {
            bool result = false;

            try
            {
                AssetManager_Software_AssetType softwareType =
                    _context.AssetManager_Software_AssetType.FirstOrDefault(x => x.Id == id);
                _context.AssetManager_Software_AssetType.Remove(softwareType);
                _context.SaveChanges();
                result = true;
                _logger.Info("The Software asset type with id " + id + " was deleted.");
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }

            return(result);
        }
Esempio n. 5
0
        public int EditSoftwareAssetTypes(int id, AssetManager_Software_AssetType softwareType)
        {
            AssetManager_Software_AssetType oldSoftwareType =
                _context.AssetManager_Software_AssetType.FirstOrDefault(x => x.Id == id);

            try
            {
                if (oldSoftwareType != null)
                {
                    oldSoftwareType.CategoryCode     = softwareType.CategoryCode;
                    oldSoftwareType.DescriptionNotes = softwareType.DescriptionNotes;
                    oldSoftwareType.EndOfLifeMo      = softwareType.EndOfLifeMo;
                    oldSoftwareType.Name             = softwareType.Name;
                }
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }

            return(softwareType.Id);
        }
Esempio n. 6
0
        public AssetManager_Software_AssetType GetSoftwareAssetTypeByID(int id)
        {
            AssetManager_Software_AssetType softwareType = _context.AssetManager_Software_AssetType.FirstOrDefault(x => x.Id == id);

            return(softwareType);
        }