// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(TempMeasurement).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TempMeasurementExists(TempMeasurement.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.TempMeasurement.Add(TempMeasurement); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } TempMeasurement.EmployeeID = Int32.Parse(SelectedEmployeeName); _context.TempMeasurement.Add(TempMeasurement); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Models.Company selectedCompany = _context.Company.FirstOrDefault(c => c.Name == SelectedCompanyName); Employee.CompanyID = selectedCompany.CompanyID; _context.Employee.Add(Employee); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Company = await _context.Company.FindAsync(id); if (Company != null) { _context.Company.Remove(Company); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } TempMeasurement = await _context.TempMeasurement.FindAsync(id); if (TempMeasurement != null) { _context.TempMeasurement.Remove(TempMeasurement); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Employee = await _context.Employee.FindAsync(id); if (Employee != null) { _context.Employee.Remove(Employee); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }