public ActionResult Create(HelperViewModel model, string button) { try { if (_helperService.IsHelperExists(model.EPFNumber, model.NIC)) { Helper helper = new Helper(); helper = Mapper.Map <Helper>(model); _helperService.SaveHelper(helper); if (button.Equals("SAVE PORTER")) { return(RedirectToAction("Index")); } ModelState.Clear(); ViewData["Success"] = "Successfully Added."; } else { ModelState.AddModelError("", "Porter EPF Number or NIC Number already exists"); } return(View()); } catch (Exception e) { return(View()); } }
public void TestLabelAndNotifyPropertyChanged() { const string labelValue = "TestLabelValue"; ManualResetEvent waitHandle = new ManualResetEvent(false); bool eventRaised = false, raisedForLabel = false; HelperViewModel viewModel = new HelperViewModel(); viewModel.PropertyChanged += (s, e) => { eventRaised = true; if (e.PropertyName == nameof(viewModel.Label)) { raisedForLabel = true; } waitHandle.Set(); }; viewModel.SetLabel(labelValue); waitHandle.WaitOne(2000); Assert.AreEqual(labelValue, viewModel.Label, "Label value not set."); Assert.IsTrue(eventRaised, "Event not raised."); Assert.IsTrue(raisedForLabel, "Event raised, but not for label."); }
// GET: Home public ActionResult Index() { var vendingItems = _db.GetVendingItems(); InventoryManager im = GetInventoryManager(); var trans = GetTransactionManager(); HelperViewModel model = GetHelperViewModel(trans, im); return(View(model)); }
private HelperViewModel GetHelperViewModel(TransactionManager trans, InventoryManager inv = null, ReportManager report = null) { HelperViewModel helper = new HelperViewModel(); helper.Inv = inv; helper.Trans = trans; helper.Report = report; return(helper); }
public IActionResult Index() { HelperViewModel helperViewModel = new HelperViewModel { ArticlesStringBuilder = _coreApplicationService.ListArticles(), ArticlesTagBuilder = _coreApplicationService.ListArticles(), ArticlesTagHelper = _coreApplicationService.ListArticles() }; return(View(helperViewModel)); }
// GET: Helper/Edit/5 public ActionResult Edit(int id) { try { Domain.Helper.Helper helper = _helperService.GetHelperById(id); HelperViewModel model = Mapper.Map <HelperViewModel>(helper); return(View(model)); } catch { return(View()); } }
public ActionResult Edit(int id, HelperViewModel model) { try { Domain.Helper.Helper helper = _helperService.GetHelperById(id); helper = Mapper.Map <Helper>(model); _helperService.EditHelper(id, helper); return(RedirectToAction("Index")); } catch (Exception e) { return(RedirectToAction("Index")); } }
private static void RunPresentation(string path) { var helperViewModel = new HelperViewModel(path); var presentationViewModel = new PresentationViewModel(path, 0, helperViewModel); var helper = new HelperView(new PresentationTime(helperViewModel)) { DataContext = helperViewModel, }; var presentationView = new PresentationView { DataContext = presentationViewModel }; presentationView.Show(); helper.Owner = presentationView; helper.Show(); presentationView.FocusOnPdf(); }