public bool delete_hoso(int id)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             Tblhoso d = db.Tblhosos.SingleOrDefault(x => x.Id == id);
             if (string.IsNullOrEmpty(d.ToString()))
             {
                 return(true);
             }
             db.Tblhosos.Remove(d);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool edit_hoso(int id, [FromBody] Tblhoso hs)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             Tblhoso d = db.Tblhosos.SingleOrDefault(x => x.Id == id);
             if (string.IsNullOrEmpty(d.ToString()))
             {
                 return(false);
             }
             if (hs.Minhchung != null)
             {
                 var arrData = hs.Minhchung.Split(';');
                 if (arrData.Length == 3)
                 {
                     var savePath = $@"assets/file/{arrData[0]}";
                     hs.Minhchung = $"{arrData[0]}";
                     SaveFileFromBase64String(savePath, arrData[2]);
                 }
             }
             else
             {
                 hs.Minhchung = d.Minhchung;
             }
             d.Ten       = hs.Ten;
             d.Ngay      = hs.Ngay;
             d.Minhchung = hs.Minhchung;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }