public List <BancoDto> Listar(BancoDto dto) { try { var dtos = DBancoConverter.ToDtos(UnitOfWork.BancoRepository.Bancos); return(dtos); } catch (Exception ex) { throw ex; } }
public void Insertar(BancoDto dto) { try { var entity = new Banco(); entity = DBancoConverter.ToEntity(dto); UnitOfWork.BancoRepository.Bancos.Add(entity); } catch (Exception ex) { throw ex; } }
public List <SucursalDto> Listar(SucursalDto dto) { try { var dtos = DSucursalConverter.ToDtos(UnitOfWork.SucursalRepository.Sucursales); foreach (var myDto in dtos) { myDto.Bancos = DBancoConverter.ToDtos(UnitOfWork.BancoRepository.Bancos); } return(dtos); } catch (Exception ex) { throw ex; } }
public void Actualizar(SucursalDto dto) { try { foreach (var entity in UnitOfWork.SucursalRepository.Sucursales) { if (dto.Id == entity.Id) { entity.Nombre = dto.Nombre; entity.Direccion = dto.Direccion; entity.FechaRegistro = dto.FechaRegistro; entity.Banco = DBancoConverter.ToEntity(dto.Banco); } } } catch (Exception ex) { throw ex; } }
public ActionResult Save(SucursalDto dto) { try { var dtoBancos = _unitOfWork.BancoRepository.Bancos; foreach (var dtoBanco in dtoBancos) { if (dto.Banco.Id == dtoBanco.Id) { dto.Banco = DBancoConverter.ToDto(dtoBanco); } } _query = new DQuery(_unitOfWork); _query.Actualizar(dto); _unitOfWork = _query.GetUnitOfWork(); } catch (Exception ex) { throw ex; } return(RedirectToAction("Index")); }