Esempio n. 1
0
        public async Task <bool> RemoveItemByIdentityAsync(int id)
        {
            BlockedNumberEntry origData = Auditing.Active ? await GetItemByIdentityAsync(id) : null;

            if (!await DataProvider.RemoveByIdentityAsync(id))
            {
                return(false);
            }

            await Auditing.AddAuditAsync($"{nameof(BlockedNumberDataProvider)}.{nameof(RemoveItemByIdentityAsync)}", Dataset, Guid.Empty,
                                         $"Remove Blocked Number {id}",
                                         DataBefore : origData,
                                         DataAfter : null
                                         );

            return(true);
        }
Esempio n. 2
0
        public async Task <bool> AddItemAsync(BlockedNumberEntry data)
        {
            data.Created = DateTime.UtcNow;
            data.Number  = PhoneNumberAttribute.GetE164(data.Number);

            if (!await DataProvider.AddAsync(data))
            {
                return(false);
            }
            await Auditing.AddAuditAsync($"{nameof(BlockedNumberDataProvider)}.{nameof(AddItemAsync)}", Dataset, Guid.Empty,
                                         $"Add Blocked Number {data.Id}",
                                         DataBefore : null,
                                         DataAfter : data
                                         );

            return(true);
        }
Esempio n. 3
0
        public async Task <UpdateStatusEnum> UpdateItemAsync(BlockedNumberEntry data)
        {
            BlockedNumberEntry origData = Auditing.Active ? await GetItemByIdentityAsync(data.Id) : null;

            data.Updated = DateTime.UtcNow;
            data.Number  = PhoneNumberAttribute.GetE164(data.Number);
            UpdateStatusEnum status = await DataProvider.UpdateByIdentityAsync(data.Id, data);

            if (status != UpdateStatusEnum.OK)
            {
                return(status);
            }

            await Auditing.AddAuditAsync($"{nameof(BlockedNumberDataProvider)}.{nameof(UpdateItemAsync)}", Dataset, Guid.Empty,
                                         $"Update Blocked Number {data.Id}",
                                         DataBefore : origData,
                                         DataAfter : data
                                         );

            return(UpdateStatusEnum.OK);
        }