static int InsertCategory() { Console.WriteLine("Inserting category..."); var category = new Category() { Name = "Processors", Created = Timestamp, Updated = Timestamp }; using (var uow = new TpcUnitOfWork(Context)) { var categoryRepository = uow.GetRepository <Category>(); categoryRepository.Insert(category); return(uow.Commit()); } }
static int InsertItem() { Console.WriteLine("Inserting item..."); var header = new Header() { Title = string.Empty.PadRight(50, 'X'), UserId = 1, Created = Timestamp, Updated = Timestamp }; var entry = new Entry() { Message = string.Empty.PadRight(2000, 'Y'), Created = Timestamp, Updated = Timestamp }; var item = new Item() { Header = header, Entry = entry, CategoryId = 2, UserId = 1, Amount = 300, Section = ItemSection.ForSale, Condition = ItemCondition.BrandNew, Warranty = ItemWarranty.Personal, Created = Timestamp, Updated = Timestamp, Expiry = Timestamp.AddDays(30) }; using (var uow = new TpcUnitOfWork(Context)) { // Insert item... var itemRepository = uow.GetRepository <Item>(); itemRepository.Insert(item); return(uow.Commit()); } }
static int InsertItem() { Console.WriteLine("Inserting item..."); var header = new Header() { Title = string.Empty.PadRight(50, 'X'), UserId = 1, Created = Timestamp, Updated = Timestamp }; var entry = new Entry() { Message = string.Empty.PadRight(2000, 'Y'), Created = Timestamp, Updated = Timestamp }; var item = new Item() { Header = header, Entry = entry, CategoryId = 2, UserId = 1, Amount = 300, Section = ItemSection.ForSale, Condition = ItemCondition.BrandNew, Warranty = ItemWarranty.Personal, Created = Timestamp, Updated = Timestamp, Expiry = Timestamp.AddDays(30) }; using (var uow = new TpcUnitOfWork(Context)) { // Insert item... var itemRepository = uow.GetRepository<Item>(); itemRepository.Insert(item); return uow.Commit(); } }
static int InsertCategory() { Console.WriteLine("Inserting category..."); var category = new Category() { Name = "Processors", Created = Timestamp, Updated = Timestamp }; using (var uow = new TpcUnitOfWork(Context)) { var categoryRepository = uow.GetRepository<Category>(); categoryRepository.Insert(category); return uow.Commit(); } }