Exemplo n.º 1
0
        public ActionResult Create(Sexo s)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    using(var mc = new ModelContainer())
                    {
                        mc.AddToSexos(s);
                        mc.SaveChanges();
                    }

                    return RedirectToAction("Index");
                }
                catch(Exception ex)
                {
                    ModelState.AddModelError("MSG", ex);
                    return View();
                }
            }
            else
            {
                return View();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new Sexo object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="nome">Initial value of the Nome property.</param>
 public static Sexo CreateSexo(global::System.String id, global::System.String nome)
 {
     Sexo sexo = new Sexo();
     sexo.Id = id;
     sexo.Nome = nome;
     return sexo;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Sexos EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSexos(Sexo sexo)
 {
     base.AddObject("Sexos", sexo);
 }