Exemplo n.º 1
0
        public async Task <int> DeleteActivityDateAsync(ActivityDateItem item)
        {
            int resCount = await mConnection.DeleteAsync(item);

            if (await UpdateParentRecentlyDateAsync(item) != 1)
            {
                return(0);
            }

            return(resCount);
        }
Exemplo n.º 2
0
        private async Task <int> UpdateParentRecentlyDateAsync(ActivityDateItem item)
        {
            var activity = await mConnection.Table <ActivityItem> ()
                           .Where(i => i.Id == item.ActivityId)
                           .FirstAsync();

            if (activity == null)
            {
                throw new InvalidOperationException();
            }
            activity.RecentlyDate = item.Date;
            return(await mConnection.UpdateAsync(activity));
        }
Exemplo n.º 3
0
        public async Task <ActivityDateItem> AddActivityDateAsync(ActivityDateItem item)
        {
            var resCount = await mConnection.InsertAsync(item);

            if (resCount == 0)
            {
                return(null);
            }

            resCount = await UpdateParentRecentlyDateAsync(item);

            if (resCount == 0)
            {
                return(null);
            }

            return(await mConnection.Table <ActivityDateItem> ()
                   .Where(i => i.Date == item.Date && i.ActivityId == item.ActivityId)
                   .FirstAsync());
        }
Exemplo n.º 4
0
 public async Task <int> UpdateActivityDateAsync(ActivityDateItem item)
 {
     return(await mConnection.UpdateAsync(item));
 }