public static CheckListItem ToCheckListItem(this CheckListItemUpdate update) => new CheckListItem { Id = update.Id, Content = update.Content, IsCompleted = update.IsCompleted };
public async Task <CheckListItem> UdpateAsync(CheckListItemUpdate item) { var result = await access.UpdateAsync(item, userContext.UserId); if (result != null) { await realTimeDataManager.CheckListItemUpdatedAsync(result); } return(result); }
public async Task <ActionResult <CheckListItem> > Update(CheckListItemUpdate checkList) { var result = await repository.UdpateAsync(checkList); if (result == null) { return(this.ValidateAndBadRequest()); } else { return(result); } }
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); }
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; }