Ejemplo n.º 1
0
        public Tblsohuu get_sohuu_id(int id)
        {
            Tblsohuu sh = new Tblsohuu();

            using (sql_NCKHContext db = new sql_NCKHContext())
            {
                sh = db.Tblsohuus.SingleOrDefault(x => x.Id == id);
            }
            return(sh);
        }
Ejemplo n.º 2
0
 public bool create_sohuu([FromBody] Tblsohuu sh)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             db.Tblsohuus.Add(sh);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool delete_sohuu(int id)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             Tblsohuu d = db.Tblsohuus.SingleOrDefault(x => x.Id == id);
             if (string.IsNullOrEmpty(d.ToString()))
             {
                 return(true);
             }
             db.Tblsohuus.Remove(d);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 public bool edit_sohuu(int id, [FromBody] Tblsohuu hs)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             Tblsohuu d = db.Tblsohuus.SingleOrDefault(x => x.Id == id);
             if (string.IsNullOrEmpty(d.ToString()))
             {
                 return(false);
             }
             d.Tensohuu    = hs.Tensohuu;
             d.Dmhtkinhphi = hs.Dmhtkinhphi;
             d.Dm          = hs.Dm;
             d.Ghichu      = hs.Ghichu;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }