public Tblloainhiemvu get_loainhiemvu_id(int id)
        {
            Tblloainhiemvu dv = new Tblloainhiemvu();

            using (sql_NCKHContext db = new sql_NCKHContext())
            {
                dv = db.Tblloainhiemvus.SingleOrDefault(x => x.Id == id);
            }
            return(dv);
        }
 public bool create_loainhiemvu([FromBody] Tblloainhiemvu lnv)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             db.Tblloainhiemvus.Add(lnv);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool delete_loainhiemvu(int id)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             Tblloainhiemvu d = db.Tblloainhiemvus.SingleOrDefault(x => x.Id == id);
             if (string.IsNullOrEmpty(d.ToString()))
             {
                 return(true);
             }
             db.Tblloainhiemvus.Remove(d);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool edit_loainhiemvu(int id, [FromBody] Tblloainhiemvu lnv)
 {
     try
     {
         using (sql_NCKHContext db = new sql_NCKHContext())
         {
             Tblloainhiemvu d = db.Tblloainhiemvus.SingleOrDefault(x => x.Id == id);
             if (string.IsNullOrEmpty(d.ToString()))
             {
                 return(false);
             }
             d.Tenloainv = lnv.Tenloainv;
             d.Ghichu    = lnv.Ghichu;
             d.C         = lnv.C;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }