public void Add(ViewCount viewCount) { using (var svc = new ServiceProxyHelper<IViewCountService>("ViewCountService")) { svc.Proxy.Add(viewCount); } }
public ViewCount Add(ViewCount viewCount) { try { return ViewCountMapper.ToDto(_viewCountRepository.Add(ViewCountMapper.ToEntity(viewCount))); } catch (Exception ex) { throw new BlogException(ex.Message, ex.InnerException); } }
public void Add(ViewCount viewCount) { var result = _viewCountLogic.Add(viewCount); if (result != null && result.Error != null) throw new Exception(result.Error.Message); var viewCounts = _viewCountLogic.Get(viewCount.PostId); var viewCountUpdate = new ViewCountUpdate { PostId = viewCount.PostId, ViewCounts = viewCounts, ClientFunction = Constants.SocketClientFunctions.ViewCountUpdate.ToString() }; _redisService.Publish(viewCountUpdate); }
private void UpdateViewCount(int postId) { try { int? userId = null; var username = User.Identity.IsAuthenticated ? User.Identity.Name : string.Empty; if (!string.IsNullOrEmpty(username)) { var user = _usersSvc.GetByUserName(username); if (user != null && user.Error == null) { userId = user.Id; } } var viewCount = new ViewCount { PostId = postId, UserId = userId }; _viewCountSvc.Add(viewCount); } catch (Exception ex) { _errorSignaler.SignalFromCurrentContext(ex); } }
public void Add(ViewCount viewCount, string authenticationToken) { throw new System.NotImplementedException(); }