public void AddEvent(OrderComment orderComment, int accountId) { var orderOwnerEvent = new UserEvent { Description = orderComment.Comment, OrderId = orderComment.OrderId, EventSunscriberId = accountId, EventPublisherId = orderComment.AuthorId, EventType = UserEventType.NewCommentTOwnedOrderEvent, CommentId = orderComment.Id }; var orderEmployeeEvent = new UserEvent { Description = orderComment.Comment, OrderId = orderComment.OrderId, EventSunscriberId = orderComment.AuthorId, EventPublisherId = orderComment.AuthorId, EventType = UserEventType.NewCommentToOrderByEmployeeEvent, CommentId = orderComment.Id }; this.Save(orderOwnerEvent); this.Save(orderEmployeeEvent); }
public OrderCommentViewModel(OrderComment comment) { this.Comment = comment.Comment; this.CreationTime = comment.CreatedTime; this.Cost = comment.ProposedCost; this.AuthorId = comment.AuthorId; }
public void AddCommentToOrder(OrderComment orderComment) { using (var context = new DataBaseContext()) { orderComment.CreatedTime = DateTime.UtcNow; context.OrderComments.Add(orderComment); context.SaveChanges(); } }
public bool AddCommentToOrder(OrderComment orderComment) { var order = orderRepository.GetById(orderComment.OrderId); if (order.Status == OrderStatus.Openned) { this.orderCommentRepository.AddCommentToOrder(orderComment); this.eventsService.AddEvent(orderComment, order.CreaterId); return true; } return false; }