Exemple #1
0
 public void DeleteToChucThi(int?tochucthiId)
 {
     try
     {
         ToChucThi tochucthi = _context.ToChucThis.Find(tochucthiId);
         if (tochucthi != null)
         {
             _context.ToChucThis.Remove(tochucthi);
         }
         _context.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        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;
            }
        }
Exemple #3
0
        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;
            }
        }