Exemplo n.º 1
0
 public ComponentTypeModel GetComponentTypeModel(int?Id = null, int assetTypeId = -1, int?assetCategoryId = -1)
 {
     if (Id.HasValue)
     {
         ComponentType componentType = _componentTypeRepository.GetComponentTypeByID(Id.Value);
         if (componentType != null)
         {
             return(new ComponentTypeModel
             {
                 ID = componentType.ID,
                 Name = componentType.Name,
                 IsActive = componentType.IsActive,
                 AssetTypeID = componentType.AssetTypeID,
                 AssetTypes = _assetTypeService.GetDropdownAssetTypes(null, componentType.AssetTypeID),
                 AssetCategoryID = componentType.AssetCategoryId,
                 AssetCategories = _assetCategoryService.GetDropdownAssetCategories(componentType.AssetCategoryId)
             });
         }
         else
         {
             throw new EntryPointNotFoundException();
         }
     }
     else
     {
         return(new ComponentTypeModel {
             AssetTypes = _assetTypeService.GetDropdownAssetTypes(assetCategoryId, assetTypeId),
             AssetCategories = _assetCategoryService.GetDropdownAssetCategories(assetCategoryId.Value)
         });
     }
 }
Exemplo n.º 2
0
 public JsonResult SetAssetTypes(int?assetCategoryId)
 {
     try
     {
         var assetTypes = _assetTypeService.GetDropdownAssetTypes(assetCategoryId);
         if (assetTypes != null)
         {
             return(Json(assetTypes, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json("Error", JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
         return(Json("Error", JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 3
0
        public SelectList GetAssetTypes(int assetCategory, int id = -1)
        {
            var assetTypes = _assetTypeService.GetDropdownAssetTypes(assetCategory, id);

            return(assetTypes);
        }