public void delete(int id) { prodRepo = new ProductoDAL(); Producto tipo = prodRepo.GetById(id); prodRepo.Delete(tipo); }
/// <summary> /// Llama a método GetById de DAL para buscar un producto por id /// </summary> /// <param name="id">inta</param> /// <returns>Producto</returns> public Producto GetById(int id) { try { return(prodDAL.GetById(id)); } catch (Exception ex) { throw ex; } }
public Producto getById(int id) { prodRepo = new ProductoDAL(); Producto tipo = prodRepo.GetById(id); if (tipo == null) { throw new Exception("No existe producto"); } return(tipo); }