protected void Add()
        {
            Model = new Models.ContactType();

            _showAdd            = true;
            _isButtonAddVisible = false;
        }
        protected async Task Hide(Models.ContactType item)
        {
            await _contactTypeService.HideAsync(item.Id);

            await SaveAsync();

            StateHasChanged();
        }
Esempio n. 3
0
        public async Task <Models.ContactType> PostContactTypeAsync(Models.ContactType contactType)
        {
            string uri = AppSettings.ContactTypesEndpoint;

            var token = await _loginService.GetOAuthToken();

            return(await _requestService.PostAsync <Models.ContactType, Models.ContactType>(uri, contactType, token));
        }
        public async Task CreateContactType(Models.ContactType contactType, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (!IsValid(contactType))
            {
                throw new BadRequestException("Registro inválido");
            }

            await _contactTypeRepository.Add(contactType, cancellationToken);
        }
        public async Task UpdatContactType(int contactTypeId, Models.ContactType contactType, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (!IsValid(contactType))
            {
                throw new BadRequestException("Registro inválido");
            }
            contactType.ContactTypeId = contactTypeId;

            await _contactTypeRepository.Edit(contactType, cancellationToken);
        }
 protected void Edit(Models.ContactType item)
 {
     _showAdd            = true;
     _isButtonAddVisible = false;
     Model = item;
 }
 public bool IsValid(Models.ContactType contactType) => contactType is
 {
Esempio n. 8
0
 public Task <Models.ContactType> PostContactTypeAsync(Models.ContactType contactType)
 {
     return(Task.FromResult(contactType));
 }