Пример #1
0
        public ActionResult SearchLog(string searchString, IEnumerable <Guid> tags, int resultCount)
        {
            var logData    = new SearchLog();
            var getTagsRes = _tgSrv.GetAll();

            if (getTagsRes.Success)
            {
                if (tags != null)
                {
                    logData.Tags =
                        getTagsRes.Entities.
                        Where(t => tags.Any(tgId => tgId == t.ID)).
                        ToList();
                }

                logData.SearchString = searchString;
                logData.ResultCount  = resultCount;
                logData.UserID       = User.GetUser().Id;
                logData.DateTime     = DateTime.Now;
                var res = _srchSrv.Add(logData);

                return(Json(res));
            }
            else
            {
                return(Json(new { Success = false, Message = getTagsRes.Message }));
            }
        }
Пример #2
0
        private void AddSearchLog(string keyword)
        {
            SearchLog searchLog = new SearchLog();

            searchLog.Id         = Guid.NewGuid();
            searchLog.SearchDate = DateTime.Now;
            searchLog.Word       = keyword;

            SearchLogService searchLogService = new SearchLogService();

            searchLogService.Add(searchLog);
        }