Created
June 25, 2013 22:15
-
-
Save pksorensen/5862964 to your computer and use it in GitHub Desktop.
A implementation of the Repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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