Example #1
0
        public ActionResult Borrar()
        {
            int id = Convert.ToInt32(Request["id"]);

            if (Request.Cookies[cookie_name] != null)
            {
                if (funcion.valid_cookie(Request.Cookies[cookie_name].Value))
                {
                    string texto = "";
                    string tipo  = "";

                    if (funcion.valid_number(id.ToString()))
                    {
                        if (productoBL.Delete(id))
                        {
                            texto = "El producto ha sido borrado exitosamente";
                            tipo  = "success";
                        }
                        else
                        {
                            texto = "Ha ocurrido un error en la base de funcion";
                            tipo  = "error";
                        }
                    }
                    else
                    {
                        texto = "ID Inválido";
                        tipo  = "warning";
                    }

                    TempData["mensaje"] = funcion.mensaje("Productos", texto, tipo);
                    return(RedirectToAction("Index", "Productos"));
                }
                else
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
Example #2
0
 public IActionResult Delete(int id)
 {
     return(ProductoBL.Delete(id) ? Ok("El producto se ha borrado con éxito") : (IActionResult)NotFound());
 }