public IViewComponentResult Invoke(Type controllerType, string actionName, string targetElementId,
     object paramObj, CudTypeEnum cudType, string innerText)
 {
     if (cudType == CudTypeEnum.Create || cudType == CudTypeEnum.Update)
     {
         var cuvm = new CreateUpdateActionViewModel()
         {
             IsVisible = IsVisible,
             FormParams = GetJsonFormParams(paramObj),
             GetFormUrl = GetFormUrl(actionName, controllerType),
             TargetElementId = targetElementId,
             InnerText = GetInnerTextForCreateUpdateAnchors(cudType, innerText)
         };
         return View("CreateUpdateActionView", cuvm);
     }
     throw new Exception("Worng method invocation. There is a method overload for creating delete actions.");
 }
 public IViewComponentResult Invoke(Type controllerType, string actionName, string targetElementId,
                                    object paramObj, CudTypeEnum cudType, string innerText)
 {
     if (cudType == CudTypeEnum.Create || cudType == CudTypeEnum.Update)
     {
         var cuvm = new CreateUpdateActionViewModel()
         {
             IsVisible       = IsVisible,
             FormParams      = GetJsonFormParams(paramObj),
             GetFormUrl      = GetFormUrl(actionName, controllerType),
             TargetElementId = targetElementId,
             InnerText       = GetInnerTextForCreateUpdateAnchors(cudType, innerText)
         };
         return(View("CreateUpdateActionView", cuvm));
     }
     throw new Exception("Worng method invocation. There is a method overload for creating delete actions.");
 }
        private string GetInnerTextForCreateUpdateAnchors(CudTypeEnum cudType, string innerText)
        {
            switch (cudType)
            {
            case CudTypeEnum.Create:
            {
                return(string.IsNullOrWhiteSpace(innerText) ? $"{innerText}<i class=\"fa fa-plus\"></i>" : innerText);
            }

            case CudTypeEnum.Update:
            {
                return(string.IsNullOrWhiteSpace(innerText) ? $"{innerText}<i class=\"fa fa-pencil\"></i>" : innerText);
            }

            case CudTypeEnum.Delete:
                return(string.IsNullOrWhiteSpace(innerText) ? $"{innerText}<i class=\"fa fa-remove\"></i>" : innerText);;

            default:
                throw new ArgumentOutOfRangeException(nameof(cudType), cudType, null);
            }
        }
        private string GetInnerTextForCreateUpdateAnchors(CudTypeEnum cudType, string innerText)
        {

            switch (cudType)
            {
                case CudTypeEnum.Create:
                    {
                        return string.IsNullOrWhiteSpace(innerText) ? $"{innerText}<i class=\"fa fa-plus\"></i>" : innerText;

                    }
                case CudTypeEnum.Update:
                    {

                        return string.IsNullOrWhiteSpace(innerText) ? $"{innerText}<i class=\"fa fa-pencil\"></i>" : innerText;

                    }
                case CudTypeEnum.Delete:
                    return string.IsNullOrWhiteSpace(innerText) ? $"{innerText}<i class=\"fa fa-remove\"></i>" : innerText; ;
                default:
                    throw new ArgumentOutOfRangeException(nameof(cudType), cudType, null);
            }
        }