Example #1
0
        //public ActionResult RegistrarOption(UserModel Data)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        ProposalBussiness ProposalLogic = new ProposalBussiness();
        //        ProposalLogi.


        //        bool existUser = false;
        //                bool valid = false;
        //                valid = RegisterUser(Data, out existUser);
        //                if (existUser)
        //                {
        //                    //si es true el usuario existe mesaje de que existe en la vista
        //                    ViewBag.ErrorUsuarioExiste = "El usuario " + Data.UserName + " ya fue registrado anteriormente";

        //                }
        //                else
        //                {
        //                    if (valid)
        //                    {
        //                        return RedirectToAction("UserList", "User");
        //                    }
        //                    else
        //                    {

        //                        ViewBag.ErrorDesconocido = "Occurió un error insertando. Por favor intentelo nuevamente.";
        //                    }
        //                }


        //    }
        //    else
        //    {
        //        return View("NewUser", Data);
        //    }
        //    return View("NewUser", Data);
        //}

        public ActionResult NewOption(string p, string n)
        {
            try
            {
                UserModel user = (UserModel)Session["User"];
                if (user == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ProposalFilter Filtro = new ProposalFilter();
                    Filtro.Email = user.Email;
                    //   Filtro.TypeVoting = 0;

                    ProposalBussiness ProposalLogic = new ProposalBussiness();

                    List <ProposalModel> ListProposal = new List <ProposalModel>();


                    NewOptionModel NewOption = new NewOptionModel();

                    NewOption.ProposalId   = p;
                    NewOption.ProposalName = n;
                    NewOption.Proposals    = ProposalLogic.SearchProposalByUser(Filtro);

                    return(View(NewOption));
                }
            }
            catch
            {
                return(View("Error"));
            }
        }
Example #2
0
        public ActionResult RegisterOption(NewOptionModel Data)
        {
            try
            {
                ProposalBussiness ProposalLogic = new ProposalBussiness();

                if (ProposalLogic.InsertOption(Data.ProposalId, Data.OptionName))
                {
                    return(RedirectToAction("NewOption", "Proposal", new { p = Data.ProposalId, n = Data.ProposalName }));
                    //return RedirectToAction("ProposalList", "Proposal");
                }
                else
                {
                    return(View("error"));
                }
            }
            catch
            {
                return(View("error"));
            }
        }