public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Brand).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrandExists(Brand.BrandID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { DateTime date = DateTime.Now; Repair.Date_Start = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second); Report.Date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second); Repair1 = await _context.Repair.ToListAsync(); StringBuilder a = new StringBuilder("RPR"); a.Append(Repair1.Count().ToString()); string b = a.ToString(); Repair.RepairName = b; _context.Repair.Add(Repair); _context.Attach(Report).State = EntityState.Modified; await _context.SaveChangesAsync(); return(RedirectToPage("./../Repairs/Index")); }
public async Task <IActionResult> OnPostAsync() { DateTime date = DateTime.Now; Repair.Date_Start = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second); Report.Date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second); _context.Attach(Repair).State = EntityState.Modified; _context.Attach(Report).State = EntityState.Modified; await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { _context.Attach(Repair).State = EntityState.Modified; await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }