예제 #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;
     }
 }
예제 #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;
            }
        }
예제 #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;
            }
        }