added controller stub. before changing idataaccess to abstract class
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace COA.EnterpriseServices.DataAccess.EntityFramework
|
||||
{
|
||||
public class EntityDataAccess<T> : IDataAccess<T> where T : class, IRecord
|
||||
public class EntityDataAccess<T> : IDataAccess<T> where T : class, IRecord, new()
|
||||
{
|
||||
public bool Add(T item)
|
||||
{
|
||||
@ -23,7 +24,23 @@ namespace COA.EnterpriseServices.DataAccess.EntityFramework
|
||||
{
|
||||
using (var context = new QuickBaseContext())
|
||||
{
|
||||
context.Entry(item);
|
||||
var entry = context.Entry(item);
|
||||
|
||||
entry.State = EntityState.Modified;
|
||||
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(int id, Action<T> update)
|
||||
{
|
||||
using (var context = new QuickBaseContext())
|
||||
{
|
||||
var item = context.Set<T>().FirstOrDefault(e => e.Id == id);
|
||||
|
||||
update(item);
|
||||
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
Reference in New Issue
Block a user