Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Murphy committed Aug 19, 2016
1 parent 64f0991 commit ed52868
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion LoveSeat.IntegrationTest/PagingHelperTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using LoveSeat.Interfaces;
using LoveSeat.Support;
using Moq;
using NUnit.Framework;

Expand Down
10 changes: 10 additions & 0 deletions LoveSeat/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public Document(T obj) : base(objectSerializer.Serialize<T>(obj)) {
public Document(T obj, IObjectSerializer objectSerializer) : base(objectSerializer.Serialize<T>(obj))
{
}

public T Item { get { return this.ToObject<T>(); } }
}

#region Bulk documents
Expand Down Expand Up @@ -119,6 +121,14 @@ public bool HasAttachment
get { return this["_attachments"] != null; }
}

public void AddAttachment(string filename, byte[] data)
{
var jobj = this.GetValue("_attachments") as JObject ?? new JObject();
jobj[filename] = new JObject();
jobj[filename]["data"] = Convert.ToBase64String(data);
this["_attachments"] = jobj;
}

public IEnumerable<string> GetAttachmentNames()
{
var attachment = this["_attachments"];
Expand Down

0 comments on commit ed52868

Please sign in to comment.