public ActionResult Alta(PlanesModel PlanNuevo) { //si el plan nuevo es del tipo PlanesModel (no puedo parsear) Planes PlanNuevoBD = new Planes(); PlanNuevoBD.Descripcion= PlanNuevo.Descripcion; PlanNuevoBD.PrecBConsulta = PlanNuevo.PrecBConsulta; PlanNuevoBD.PrecBFarmacia = PlanNuevo.PrecBFarmacia; PlanNuevoBD.Codigo = PlanNuevo.Codigo; BaseDeDatos.Planes.AddObject(PlanNuevoBD); //si el plann nuevo es del tipo Planes //BaseDeDatos.Planes.AddObject(PlanNuevo); try { BaseDeDatos.SaveChanges(); } catch (OptimisticConcurrencyException) { ViewBag.error = "No se pudo crear el registro"; return View(PlanNuevo); } ViewBag.ok = "Registro creado correctamente"; return View(); }
/// <summary> /// Deprecated Method for adding a new object to the Planes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPlanes(Planes planes) { base.AddObject("Planes", planes); }
/// <summary> /// Create a new Planes object. /// </summary> /// <param name="idPlan">Initial value of the IdPlan property.</param> public static Planes CreatePlanes(global::System.Int32 idPlan) { Planes planes = new Planes(); planes.IdPlan = idPlan; return planes; }