Example #1
0
        protected override async Task OnInitializedAsync()
        {
            NewItem = new ItemCreateApiModel();

            ApiCallResult <IList <ItemApiModel> > apiCallResult = await AppHttpClient.GetAsync <IList <ItemApiModel> >(ApiUrls.GetItemsList);

            Items = apiCallResult.IsSuccess
        ? apiCallResult.Value !
        : throw new Exception("API call is not successful");
        }
Example #2
0
        public async Task <ActionResult <ItemApiModel> > CreateAsync(ItemCreateApiModel item, CancellationToken cancellationToken)
        {
            CreateItemCommand command = new(item.Text, User.GetIdentityId());

            ItemDTO result = await mediator.Send(new RemoveCachedItemsCommand <CreateItemCommand, ItemDTO>(command), cancellationToken);

            return(new ItemApiModel
            {
                Id = result.Id,
                IsDone = result.IsDone,
                Text = result.Text,
                Priority = result.Priority
            });
        }