public async Task <IActionResult> DeleteTransactionType(long id)
        {
            var modelToDelete = await _transactionTypeService.GetById(id);

            if (modelToDelete == null)
            {
                return(NotFound());
            }
            var result = await _transactionTypeService.Delete(id);

            return(Ok(result));
        }
        // DELETE api/<controller>/5
        public IHttpActionResult Delete(long id, string updatedBy)
        {
            try
            {
                _transactionTypeService.Delete(id, updatedBy);
                Log.Info(
                    $"{typeof(TransactionTypesController).FullName}||{UserEnvironment}||Delete record successful.");

                return(Content(HttpStatusCode.OK, "Transaction type record deleted"));
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
        }
Пример #3
0
        public async Task <IHttpActionResult> Delete([FromODataUri] int TransactionTypeID)
        {
            var item = await _service.FindAsync(TransactionTypeID);

            if (item == null)
            {
                return(NotFound());
            }

            item.ObjectState = ObjectState.Deleted;

            _service.Delete(item);
            await _unitOfWorkAsync.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #4
0
 public async Task Delete(Guid id) =>
 await _transactionTypeService.Delete(id);