public static CheckListItem ToCheckListItem(this CheckListItemUpdate update)
 => new CheckListItem
 {
     Id          = update.Id,
     Content     = update.Content,
     IsCompleted = update.IsCompleted
 };
コード例 #2
0
        public async Task <CheckListItem> UdpateAsync(CheckListItemUpdate item)
        {
            var result = await access.UpdateAsync(item, userContext.UserId);

            if (result != null)
            {
                await realTimeDataManager.CheckListItemUpdatedAsync(result);
            }
            return(result);
        }
コード例 #3
0
        public async Task <ActionResult <CheckListItem> > Update(CheckListItemUpdate checkList)
        {
            var result = await repository.UdpateAsync(checkList);

            if (result == null)
            {
                return(this.ValidateAndBadRequest());
            }
            else
            {
                return(result);
            }
        }
コード例 #4
0
        public async Task <CheckListItem> UpdateAsync(CheckListItemUpdate update, int userId)
        {
            var toUpdate = await context.CheckListItems.SingleOrDefaultAsync(c => c.Id == update.Id &&
                                                                             c.CheckList.UserId == userId);

            if (toUpdate != null)
            {
                toUpdate.UpdateFrom(update);
                toUpdate.UpdatedOn = DateTime.Now;
                await context.SaveChangesAsync();
            }
            return(toUpdate);
        }
コード例 #5
0
 public async Task <CheckListItem> UpdateAsync(CheckListItemUpdate checkList)
 => await apiClient.Consumer.PutAsync <CheckListItem>(string.Empty, checkList);
 public static void UpdateFrom(this CheckListItem item, CheckListItemUpdate update)
 {
     item.Content     = update.Content;
     item.IsCompleted = update.IsCompleted;
 }