//This is the main post method in which the server receives data from the user. public async Task <IActionResult> OnPost(string firstname, string lastname, bool fixpayment, int?days, int?hours, int rate) { var resalt = Validation.InputValidation(firstname, lastname, days, hours, rate); if (resalt != "Ok") { ViewData["Message"] = resalt; } else { var emploee = new Emploees { F_NAME = firstname, L_NAME = lastname, FIX_PAYMENT = fixpayment, COUNT_DAYS = days, COUNT_HOUR = hours, RATE = rate }; await _context.Emploees.AddAsync(emploee); await _context.SaveChangesAsync(); return(Redirect("/Index")); } //This is the inverse filling of the page with data in case of incorrect entries. Emploees = _context.Emploees.AsNoTracking().ToList(); ViewData["firstname"] = firstname; ViewData["lastname"] = lastname; ViewData["fixpayment"] = fixpayment; ViewData["days"] = days; ViewData["hours"] = hours; ViewData["rate"] = rate; ViewData["hidden"] = "visible"; ViewData["visibility"] = "hidden"; return(Page()); }
public IEnumerator <Worker> GetEnumerator() { return(Emploees.GetEnumerator()); }