Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Planes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPlanes(Planes planes)
 {
     base.AddObject("Planes", planes);
 }
Exemplo n.º 3
0
 /// <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;
 }