public async Task <IActionResult> Edit(string id, [Bind("ShiId,ShiNm,MaxHr,MinHr,ConH1,AddH1,ConH2,AddH2,BltNm,BltDt,LstNm,LstDt,Tim02,OnnTm,OffTm,NigSh,OnnOt")] Tblroster tblroster) { if (id != tblroster.ShiId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tblroster); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException dbex) { if (!TblrosterExists(tblroster.ShiId)) { //return NotFound(); Danger(string.Format("<b>Lỗi {0}</b>", "Not Found"), true); } else { Danger(string.Format("<b>Lỗi {0}</b>", dbex.Message + dbex.InnerException), true); } return(View(tblroster)); } return(RedirectToAction(nameof(Index))); } return(View(tblroster)); }
public async Task <IActionResult> Create([Bind("ShiId,ShiNm,MaxHr,MinHr,ConH1,AddH1,ConH2,AddH2,BltNm,BltDt,LstNm,LstDt,Tim02,OnnTm,OffTm,NigSh,OnnOt")] Tblroster tblroster) { if (ModelState.IsValid) { try { _context.Add(tblroster); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { Danger(string.Format("<b>Lỗi {0}</b>", ex.Message + ex.InnerException), true); } } return(View(tblroster)); }
// GET: Admin/Tblrosters/Edit/5 public async Task <IActionResult> Edit(string id) { var tblroster = new Tblroster(); try { if (id == null) { return(NotFound()); } tblroster = await _context.Tblroster.FindAsync(id); if (tblroster == null) { return(NotFound()); } } catch (Exception ex) { Danger(string.Format("<b>Lỗi {0}</b>", ex.Message + ex.InnerException), true); } return(View(tblroster)); }