public void DeleteToChucThi(int?tochucthiId) { try { ToChucThi tochucthi = _context.ToChucThis.Find(tochucthiId); if (tochucthi != null) { _context.ToChucThis.Remove(tochucthi); } _context.SaveChanges(); } catch (Exception) { throw; } }
public long?UpdateToChucThi(ToChucThi tochucthi) { try { long?result = -1; if (tochucthi != null) { //monthi.CreateDate = DateTime.Now; _context.Entry(tochucthi).State = EntityState.Modified; _context.SaveChanges(); result = tochucthi.ID; } return(result); } catch (Exception) { throw; } }
public long?AddToChucThi(ToChucThi tochucthi) { try { long?result = -1; if (tochucthi != null) { tochucthi.Status = true; //usermaster.CreateDate = DateTime.Now; _context.ToChucThis.Add(tochucthi); _context.SaveChanges(); result = tochucthi.ID; } return(result); } catch (Exception) { throw; } }