public void Guardar(Entity.Credito credito) { FileStream fileStream = new FileStream(ruta, FileMode.Append); StreamWriter writer = new StreamWriter(fileStream); writer.WriteLine(credito.ToString()); writer.Close(); fileStream.Close(); }
public List <Entity.Credito> Consultar() { creditos.Clear(); FileStream fileStream = new FileStream(ruta, FileMode.OpenOrCreate); StreamReader reader = new StreamReader(fileStream); string line = string.Empty; while ((line = reader.ReadLine()) != null) { Entity.Credito credito = Map(line); creditos.Add(credito); } fileStream.Close(); reader.Close(); return(creditos); }
public void Modificar(Entity.Credito credito) { creditos.Clear(); creditos = Consultar(); FileStream fileStream = new FileStream(ruta, FileMode.Create); fileStream.Close(); foreach (var item in creditos) { if (item.Identificacion != credito.Identificacion) { Guardar(item); } else { Guardar(credito); } } }
public void AgregarCredito(Credito credito) { Credito = credito; }