Пример #1
0
        public async Task <ActionResult> Delete([Required] IEnumerable <Guid> ids, CancellationToken ct = default)
        {
            var tasks = await _tasksService.GetListAsync(ids, ct);

            return(await ActionIfAllowed(
                       () => _tasksService.DeleteAsync(_userContext.UserId, tasks.Select(x => x.Id), ct),
                       Roles.Tasks,
                       tasks.Select(x => x.AccountId)));
        }
Пример #2
0
        public async Task DeleteAsync(Guid id)
        {
            var tasks = await _tasksService.GetAllAsync(id);

            foreach (var task in tasks)
            {
                await _tasksService.DeleteAsync(task.Id);
            }

            var data = await _repository.GetAsync(id);

            await _repository.DeleteAsync(data);
        }
        public async Task <ActionResult <Guid> > Delete(Guid id)
        {
            try
            {
                await _tasksService.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest("Somthing went wrong, Please try again later" + ex.Message));
            }
        }
Пример #4
0
        public async Task <IActionResult> DeleteAsync(Guid id)
        {
            var data = await _service.GetAsync(id);

            if (data == null)
            {
                _loger.LogError("Not found data for id : " + id.ToString());

                var error = new NotFound("Not found data for id : " + id.ToString(), new { id });
                return(error.ReturnResponse());
            }

            await _service.DeleteAsync(id);

            var result = new OK("Success delete data " + data.Name, new { id });

            return(result.ReturnResponse());
        }