Beispiel #1
0
        public async Task <IActionResult> Delete(Guid id)
        {
            DeleteFAGTextRequest request = new DeleteFAGTextRequest {
                Id = id
            };

            return(Ok(await _mediator.Send(new DelteFAGTextCommand(request))));
        }
Beispiel #2
0
        public async Task <FAGTextResponse> DeleteFAGTextAsync(DeleteFAGTextRequest request)
        {
            if (request?.Id == null)
            {
                throw new ArgumentNullException();
            }

            FAGText result = await _fagTextRespository.GetAsync(request.Id);

            if (result == null)
            {
                throw new ArgumentException($"Entity with {request.Id} is not present");
            }

            _fagTextRespository.Update(result);
            int modifiedRecords = await _fagTextRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Logging.Events.Delete, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);

            return(_fagTextMapper.Map(result));
        }