Ejemplo n.º 1
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.º 2
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);
     }
 }