File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Infrastructure.Data.MongoDb Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ public interface ICategoryRepository
99 ICategory Get ( Guid id ) ;
1010 ICategory GetByName ( string name ) ;
1111 IList < ICategory > GetAll ( ) ;
12- ICategory Add < ICategory > ( ICategory category ) ;
13- ICategory Save < ICategory > ( ICategory category ) ;
12+ ICategory Add ( ICategory category ) ;
13+ ICategory Save ( ICategory category ) ;
1414 ICategory Delete ( Guid id ) ;
1515 }
1616}
Original file line number Diff line number Diff line change @@ -7,9 +7,18 @@ namespace CompanyName.Notebook.NoteTaking.Infrastructure.Data.MongoDb
77
88 public class CategoryRepository : ICategoryRepository
99 {
10- public ICategory Add < ICategory > ( ICategory category )
10+ public ICategory Add ( ICategory category )
1111 {
12- throw new NotImplementedException ( ) ;
12+ var newCategory = new Category ( )
13+ {
14+ Id = Guid . NewGuid ( ) ,
15+ Name = category . Name ,
16+ Created = category . Created ,
17+ Notes = new List < INote > ( category . Notes ) ,
18+ Subscribers = new List < ISubscriber > ( category . Subscribers )
19+ } ;
20+ Console . WriteLine ( $ "Add new Category\n ${ newCategory } ") ;
21+ return newCategory ;
1322 }
1423
1524 public ICategory Delete ( Guid id )
@@ -32,7 +41,7 @@ public ICategory GetByName(string name)
3241 throw new NotImplementedException ( ) ;
3342 }
3443
35- public ICategory Save < ICategory > ( ICategory category )
44+ public ICategory Save ( ICategory category )
3645 {
3746 throw new NotImplementedException ( ) ;
3847 }
You can’t perform that action at this time.
0 commit comments