public void Update(AHU ahu) { using (var context = new InventoryContext()) { context.Entry(ahu).State = EntityState.Modified; context.SaveChanges(); } }
public void Add(AHU ahu) { using (var context = new InventoryContext()) { context.AHUs.Add(ahu); context.SaveChanges(); } }
private void InitTabRegion(long AHUID) { if (AHUID == 0) { return; } AHU objSummry = new AHU(); objSummry = ahuTransServices.GetAHUDetails(AHUID); ObservableCollection <AHUTransaction> lstTrnx = new ObservableCollection <AHUTransaction>(); foreach (var obj in ahuTransServices.GetAHUTransactionByAHUID(AHUID)) { lstTrnx.Add(obj); } IRegion tabRegion = regionManager.Regions[RegionNames.TabRegionAHU]; if (tabRegion == null) { return; } AHUDetailsSummaryView summryView = tabRegion.GetView("AHUDetailsSummaryView") as AHUDetailsSummaryView; AHUDetailsTransactionView trnxView = tabRegion.GetView("AHUDetailsTransactionView") as AHUDetailsTransactionView; if (summryView == null && trnxView == null) { summryView = this.container.Resolve <AHUDetailsSummaryView>(); trnxView = this.container.Resolve <AHUDetailsTransactionView>(); tabRegion.Add(summryView, "AHUDetailsSummaryView"); tabRegion.Add(trnxView, "AHUDetailsTransactionView"); } tabRegion.Activate(summryView); AHUDetailsSummaryViewModel summryVM = summryView.DataContext as AHUDetailsSummaryViewModel; AHUDetailsTransactionViewModel trnxVM = trnxView.DataContext as AHUDetailsTransactionViewModel; if (summryVM != null && trnxVM != null) { summryVM.summryObj = objSummry; trnxVM.trnxCollection = lstTrnx; } }