public void CreateActItem(ActItem actItem) { actItem.CreateTime = DateTime.Now; actItem.UpDateTime = DateTime.Now; actItem.ValidStatus = (int)ValidStatus.TRUE; dbService.Add<ActItem>(actItem); }
public ActItem UpdateActItem(ActItem actItem) { var filter = filterBuilder.Where(x => x.ID == actItem.ID); actItem.CreateTime = dbService.Query(filter).Result[0].CreateTime; actItem.UpDateTime = DateTime.Now; var result = dbService.Update<ActItem>(filter, actItem).Result; if (result.IsModifiedCountAvailable && result.ModifiedCount == 1) { return dbService.Query<ActItem>(filter).Result[0]; } else { return new ActItem(); } }