Esempio n. 1
0
        // GET: Plan



        public ActionResult Index()
        {
            if (TempData["State"] != null)
            {
                var st = (State)TempData["State"];
                TempData["statedata"] = st;
                TempData.Keep("State");

                var a = plan_RecipeService.ListarporPlan(st);

                Plans_Recipes vacio = new Plans_Recipes();
                ICollection <Plans_Recipes> planRecipiente = new List <Plans_Recipes>();
                planRecipiente.Add(vacio);


                if (a != null)
                {
                    var plandata_aux = planService.ListarByState(st).setPlanRecipe(a);
                    TempData["Plan"]   = planService.ListarByState(st);
                    TempData["stated"] = st;
                    TempData.Keep("stated");
                    TempData.Keep("Plan");
                    return(View(planService.ListarByState(st).getPlanRecipe()));
                }
                else
                {
                    return(View(planRecipiente));
                }
            }
            else
            {
                return(View(plan_RecipeService.Listar()));
            }
        }
        public bool Insertar(Plans_Recipes a)
        {
            var db = new Nu34lifeEntities();

            db.Plans_Recipes.Add(a);
            db.SaveChanges();
            return(true);
        }
Esempio n. 3
0
        public ActionResult CreatePlan_Recipe(Plans_Recipes m)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                var Data     = TempData["stated"] as State;
                var plandata = (Plan)TempData["Plan"];
                TempData.Keep("Plan");
                TempData.Keep("stated");
                var state = stateService.ListarPorId(Data.GetId());


                var planbyservice = planService.ListarByState(Data);
                m.setPlan_Id(plandata.Id);


                var cond = plan_RecipeService.Insertar(m);
                m.setPlan(planbyservice);

                if (cond)
                {
                    TempData["State"] = state;
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error al agregar la membresia", ex);
                return(View());
            }
        }
Esempio n. 4
0
 public bool Actualizar(Plans_Recipes a)
 {
     return(plan_RecipeRepository.Actualizar(a));
 }
Esempio n. 5
0
 public bool Insertar(Plans_Recipes a)
 {
     return(plan_RecipeRepository.Insertar(a));
 }
 public bool Actualizar(Plans_Recipes a)
 {
     throw new NotImplementedException();
 }