public async Task UpdateCustomAttribute(Guid customAttributeId, CustomAttributeInfoModel model)
 {
     await Commands.UpdateCustomAttribute(
         customAttributeId,
         model.Name,
         model.Type,
         model.Description,
         model.UnitOfMeasure,
         model.Values);
 }
Ejemplo n.º 2
0
        public async Task UpdateCustomAttribute(Guid attributeId, CustomAttributeInfoModel model)
        {
            var url = UrlBuilder.UpdateCustomAttributeUrl(attributeId);

            var response = await Client.PutAsJsonAsync(url, model);

            if (!response.IsSuccessStatusCode)
            {
                throw new ApplicationException($"Update custom attribute {attributeId} call ended with status code {response.StatusCode}");
            }
        }
Ejemplo n.º 3
0
        public async Task CreateNewCustomAttribute(CustomAttributeInfoModel model)
        {
            var url = UrlBuilder.CreateNewCustomAttributeUrl();

            var response = await Client.PostAsJsonAsync(url, model);

            if (!response.IsSuccessStatusCode)
            {
                throw new ApplicationException($"Create new custom attribute call ended with status code {response.StatusCode}");
            }
        }
        async Task CreateNewCustomAttribute(CustomAttributeInfoModel newAttribute)
        {
            try
            {
                await Client.CreateNewCustomAttribute(newAttribute);

                Navigation.NavigateTo("catalog/customattributes");
            }
            catch
            {
                errorRaised = true;
            }
        }
Ejemplo n.º 5
0
 async Task UpdateCustomAttribute(CustomAttributeInfoModel model)
 {
     try
     {
         await Client.UpdateCustomAttribute(_AttributeId, model);
     }
     catch
     {
         errorRaised = true;
     }
     finally
     {
         StateHasChanged();
     }
 }
        void Cancel()
        {
            Model = new CustomAttributeInfoModel
            {
                Description   = _originalModel.Description,
                Name          = _originalModel.Name,
                Type          = _originalModel.Type,
                UnitOfMeasure = _originalModel.UnitOfMeasure,
                Values        = _originalModel.Values
            };

            if (Readonly)
            {
                editingEnabled = false;
            }

            StateHasChanged();
        }
        protected override Task OnInitializedAsync()
        {
            context        = new EditContext(Model);
            editingEnabled = !Readonly;

            _originalModel = new CustomAttributeInfoModel
            {
                Description   = Model.Description,
                Name          = Model.Name,
                Type          = Model.Type,
                UnitOfMeasure = Model.UnitOfMeasure,
                Values        = Model.Values
            };

            values = Model.Values.Select(v => v.ToString()).ToList();

            return(base.OnInitializedAsync());
        }
        public async Task <Guid> CreateNewCustomAttribute(CustomAttributeInfoModel model)
        {
            var customAttributeId = await Commands.CreateNewCustomAttribute(model.Name, model.Type, model.Description, model.UnitOfMeasure, model.Values);

            return(customAttributeId);
        }