public JsonResult CreateOrderNote(int id, OrderNoteViewModel orderNoteViewModel, [DataSourceRequest] DataSourceRequest dataSourceRequest)
        {
            // TODO: Use the current windows identity instead of hard coding.
            User user = _userRepository.GetUserById(1);

            OrderNote orderNote = new OrderNote
            {
                Note = orderNoteViewModel.Note,
                PostedDate = DateTime.UtcNow,
                UserId = user.UserId,
                OrderId = id
            };

            orderNoteViewModel.Author = user.FullName;

            _orderNotesRepository.Add(orderNote);
            _orderNotesRepository.SaveChanges();

            orderNoteViewModel.OrderNoteId = orderNote.OrderNoteId;

            var resultData = new[] {orderNoteViewModel};
            return Json(resultData.AsQueryable().ToDataSourceResult(dataSourceRequest));
        }
 public void Add(OrderNote orderNote)
 {
     _salesHubDbContext.OrderNotes.Add(orderNote);
 }