示例#1
0
        public async Task <ActivityItem> AddActivityAsync(ActivityItem item)
        {
            var resCount = await mConnection.InsertAsync(item);

            if (resCount == 0)
            {
                return(null);
            }
            return(await mConnection.Table <ActivityItem> ()
                   .Where(i => i.Name == item.Name)
                   .FirstAsync());
        }
示例#2
0
        public async Task <int> DeleteActivityAsync(ActivityItem item)
        {
            int resCount = await mConnection.DeleteAsync(item);

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

            var detailItems = await mConnection.Table <ActivityDateItem> ()
                              .Where(d => d.ActivityId == item.Id)
                              .ToListAsync();

            foreach (var d in detailItems)
            {
                resCount += await mConnection.DeleteAsync(d);
            }
            return(resCount);
        }
示例#3
0
 public async Task <int> UpdateActivityAsync(ActivityItem item)
 {
     return(await mConnection.UpdateAsync(item));
 }