Exemplo n.º 1
0
        private void handleDeleteTableViewRowAction(UITableViewRowAction _, NSIndexPath indexPath)
        {
            SwipeToDeleteWasUsed?.Invoke(this, EventArgs.Empty);
            var timeEntry = (TimeEntryViewModel)GetItemAt(indexPath);

            DeleteTimeEntryCommand.Execute(timeEntry);
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Delete(DeleteTimeEntryCommand command)
        {
            try
            {
                await timeEntryService.DeleteTimeEntry(command);

                return(Ok());
            }
            catch (ValidationException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (AuthorizationException)
            {
                return(StatusCode(System.Net.HttpStatusCode.Forbidden));
            }
        }
        async Task ITimeEntryService.DeleteTimeEntry(DeleteTimeEntryCommand command)
        {
            var currentPrincipal = await currentUserResolver.ResolveCurrentClaimsPrincipalAsync();

            await authorizationService.AuthorizeResourceType(currentPrincipal, Operation.Delete, typeof(TimeEntry));

            Check.NotNull(command, errorMessage: "Command can not be null.");
            await validationService.Validate(command);

            var existingTimeEntry = await timeEntryRepository.GetTimeEntryById(command.TimeEntryId);

            if (existingTimeEntry == null)
            {
                return;
            }

            await authorizationService.AuthorizeResource(currentPrincipal, Operation.Delete, existingTimeEntry);

            await timeEntryRepository.DeleteTimeEntry(existingTimeEntry);
        }
Exemplo n.º 4
0
        private void handleDeleteTableViewRowAction(UITableViewRowAction _, NSIndexPath indexPath)
        {
            var timeEntry = (TimeEntryViewModel)GetItemAt(indexPath);

            DeleteTimeEntryCommand.Execute(timeEntry);
        }