Esempio n. 1
0
        public async Task <bool> DeleteVendorByIdAsync(string id)
        {
            bool deleted = false;


            var getVendorForDelete = await _repository.GetVendorByIdAsync(id);


            var vendorDeleteDTO = new VendorUpdateDTO
            {
                Id    = getVendorForDelete.Id,
                Name  = getVendorForDelete.Name,
                Title = getVendorForDelete.Title,
                Date  = getVendorForDelete.Date
            };
            string json = JsonConvert.SerializeObject(vendorDeleteDTO);

            var history = new History()
            {
                VendorId   = vendorDeleteDTO.Id,
                Operation  = "Delete",
                JsonResult = json,
            };

            await _repository.DeleteVendorAndInsertHistoryAsync(getVendorForDelete, history);

            if (getVendorForDelete != null)
            {
                deleted = true;
            }

            return(deleted);
        }