public ViewResult Index() { DbOps context = HttpContext.RequestServices.GetService(typeof(DbOps)) as DbOps; context.UpdatePeopleRecordCounterInDb(); ViewBag.peopleOnConvention = context.NumberOfPeopleActuallyOnConvention(); ViewBag.uniqueBarcodes = context.UniqueBarCodes(); ViewBag.peopleRecord = context.GetPeopleMaxRecordCounterFromDb(); return(View()); }
public ViewResult Index(Player model) { DbOps context = HttpContext.RequestServices.GetService(typeof(DbOps)) as DbOps; if (ModelState.IsValid) { context.PeopleMigration(model.Barcode); context.UpdatePeopleRecordCounterInDb(); ModelState.Clear(); } //ModelState is a property of base class - Controller //if false - razor engine will generate info about error in view (based on return View() below) //we can set the view basing on if statement //ModelState.Clear(); to clear the form in view ViewBag.peopleOnConvention = context.NumberOfPeopleActuallyOnConvention(); ViewBag.uniqueBarcodes = context.UniqueBarCodes(); ViewBag.peopleRecord = context.GetPeopleMaxRecordCounterFromDb(); return(View()); }