Skip to content

Instantly share code, notes, and snippets.

@pksorensen
Created June 25, 2013 22:15
Show Gist options
  • Save pksorensen/5862964 to your computer and use it in GitHub Desktop.
Save pksorensen/5862964 to your computer and use it in GitHub Desktop.
A implementation of the Repository.
namespace Composite.Core.WebApi
{
using Composite.Data;
using System.Linq;
public class C1ApiRepository<T> : IC1Repository<T> where T : class, IData
{
DataConnection conn = new DataConnection();
public IQueryable<T> GetAll()
{
return conn.Get<T>();
}
public T Add(T item)
{
return conn.Add<T>(item);
}
public void Remove(T item)
{
conn.Delete<T>(item);
}
public bool Update(T item)
{
try
{
conn.Update(item);
return true;
}
catch
{
return false;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment