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 })); } }
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); }