예제 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected Task <bool> OnSaveAsync(BindItem item)
 {
     // 增加数据演示代码
     if (item.Id == 0)
     {
         // 演示代码,生产中请根据实际情况考虑是否加锁操作
         lock (_objectLock)
         {
             item.Id = EditItems.Max(i => i.Id) + 1;
             EditItems.Add(item);
         }
     }
     else
     {
         var oldItem = EditItems.FirstOrDefault(i => i.Id == item.Id);
         if (oldItem != null)
         {
             oldItem.Name      = item.Name;
             oldItem.Address   = item.Address;
             oldItem.DateTime  = item.DateTime;
             oldItem.Count     = item.Count;
             oldItem.Complete  = item.Complete;
             oldItem.Education = item.Education;
         }
     }
     return(Task.FromResult(true));
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected static Task OnResetSearchAsync(BindItem item)
 {
     item.Name    = "";
     item.Address = "";
     return(Task.CompletedTask);
 }