Example #1
0
        public IActionResult Detalle(string equipo1, string equipo2)
        {
            if (equipo1.Length > 3)
            {
                throw new ArgumentException("El equipo 1 es incorrecto");
            }
            if (equipo1.Equals("RIB", StringComparison.CurrentCultureIgnoreCase) ||
                equipo2.Equals("RIB", StringComparison.CurrentCultureIgnoreCase))
            {
                var ex = new PartidoMalFormadoException()
                {
                    Equipo1 = equipo1,
                    Equipo2 = equipo2
                };

                logger.LogError(ex.ToString());
            }
            try
            {
                var resultado = equipo1.Length / (equipo2.Length - 1);
                ViewBag.Resultado = resultado;
            }
            catch (DivideByZeroException ex)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw;
            }

            return(View());
        }
Example #2
0
        public IActionResult Detalle(string equipo1, string equipo2)
        {
            _logger.LogInformation("lala");
            if (equipo1.Length > 3)
            {
                throw new ArgumentException("El equipo 1 es incorrecto");
            }
            throw new ArgumentException("Todo bien");

            if (equipo1.Equals("RIB") || equipo2.Equals("RIB"))
            {
                var ex = new PartidoMalFormadoException()
                {
                    Equipo1 = equipo1,
                    Equipo2 = equipo2
                };

                _logger.LogError("ex.ToString");
                try
                {
                    var resultado = equipo1.Length / (equipo2.Length - 1);
                    ViewBag.Resultado = resultado;
                }
                catch (DivideByZeroException ex)
                {
                    //   Logger
                }
                catch (Exception ex)
                {
                    //   Logger
                }

                return(View());
            }
        }