Refactored repository pattern for Add and Update methods so that they return their respective entity objects

This commit is contained in:
Shaun Walker
2019-08-05 09:31:04 -04:00
parent b9c007998e
commit 4fda7b17d0
43 changed files with 353 additions and 137 deletions

View File

@ -40,12 +40,13 @@ namespace Oqtane.Repository
}
}
public void AddPageModule(PageModule PageModule)
public PageModule AddPageModule(PageModule PageModule)
{
try
{
db.PageModule.Add(PageModule);
db.SaveChanges();
return PageModule;
}
catch
{
@ -53,12 +54,13 @@ namespace Oqtane.Repository
}
}
public void UpdatePageModule(PageModule PageModule)
public PageModule UpdatePageModule(PageModule PageModule)
{
try
{
db.Entry(PageModule).State = EntityState.Modified;
db.SaveChanges();
return PageModule;
}
catch
{