Пример #1
0
        public NoteContent CreateNote(Guid custid, NoteContent noteContent)
        {
            var consultantKey = _consultantContext.Consultant.ConsultantKey.Value;
            var command = new AddCustomerNote
            {
                CustomerId = custid,
                CustomerNote = new CustomerNote
                {
                    ConsultantKey   = consultantKey,
                    Content         = noteContent.Content,
                    CustomerId      = custid,
                    CustomerNoteKey = Guid.NewGuid(),
                    DateCreatedUtc  = DateTime.UtcNow
                }
            };

            _clientFactory.GetCommandServiceClient().Execute(command);

            return new NoteContent
            {
                Content         = command.CustomerNote.Content,
                DateCreatedUtc  = command.CustomerNote.DateCreatedUtc,
                CustomerNoteKey = command.CustomerNote.CustomerNoteKey
            };
        }
Пример #2
0
        public HttpStatusCode DeleteNote(Guid custid, Guid id, NoteContent noteContent)
        {
            var client = _clientFactory.GetCommandServiceClient();

            var command = new DeleteCustomerNote
            {
                CustomerId = custid,
                CustomerNoteKey = id
            };

            client.Execute(command);
            return HttpStatusCode.OK;
        }
Пример #3
0
        public HttpStatusCode UpdateNote(Guid custid, Guid id, NoteContent noteContent)
        {
            var consultantKey = _consultantContext.Consultant.ConsultantKey.Value;
            var command = new Quartet.Entities.Commands.UpdateCustomerNote
            {
                CustomerId = custid,
                CustomerNote = new CustomerNote
                {
                    ConsultantKey   = consultantKey,
                    Content         = noteContent.Content,
                    CustomerId      = custid,
                    CustomerNoteKey = noteContent.CustomerNoteKey,
                    DateCreatedUtc  = noteContent.DateCreatedUtc.ToUniversalTime()
                }
            };

            _clientFactory.GetCommandServiceClient().Execute(command);
            return HttpStatusCode.OK;
        }