public void alterar(filial fil)
 {
     using (locadoraEntities1 db = new locadoraEntities1())
     {
         db.Entry(fil).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
 public void excluir(filial fil)
 {
     using (locadoraEntities1 db = new locadoraEntities1())
     {
         db.Entry(fil).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }
 public void inserir(filial fil)
 {
     using (locadoraEntities1 db = new locadoraEntities1())
     {
         db.filial.Add(fil);
         db.SaveChanges();
     }
 }
        public filial selecionar(int codigo)
        {
            filial fil = null;

            using (locadoraEntities1 db = new locadoraEntities1())
            {
                fil = (from filial in db.filial where filial.filial_codigo == codigo select filial).FirstOrDefault();
            }
            return(fil);
        }