public async Task AddComment(AddTableItemCommentInputModel model) { var table = await GetPendingItems <TableItemViewModel>(model.TableId); var items = table.ToList(); var item = items[model.ItemIndex]; var commentedItem = items.FirstOrDefault(x => (x.Comment == model.Comment) && (x.ProductId == item.ProductId)); if (item != null && commentedItem == null) { await this.RemovePendingItem(model.TableId, model.ItemIndex); table = await GetPendingItems <TableItemViewModel>(model.TableId); items = table.ToList(); item.Comment = model.Comment; items.Add(item); SessionHelper.SetObjectAsJson(context.HttpContext.Session, model.TableId.ToString(), items.OrderBy(x => x.ModifiedOn)); } else if (commentedItem != null) { SessionHelper.SetObjectAsJson(context.HttpContext.Session, model.TableId.ToString(), items.OrderBy(x => x.ModifiedOn)); await this.RemovePendingItem(model.TableId, model.ItemIndex); } }
public void AddComment(AddTableItemCommentInputModel model) { tableItemService.AddComment(model); }