Ejemplo n.º 1
0
        public ActionResult Add(Person person)
        {
            PeopleDb db = new PeopleDb(_connectionString);

            db.Add(person);
            return(Redirect("/people/index"));
        }
Ejemplo n.º 2
0
        public IActionResult Add(Person person)
        {
            var db = new PeopleDb(_connectionString);

            db.Add(person);
            return(Json(person));
        }
Ejemplo n.º 3
0
        public ActionResult Save(string name, string address, string nopoint)
        {
            var      db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True");
            Customer c  = new Customer();

            c.Name    = name;
            c.Address = address;
            db.Add(c);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        public IActionResult AddPerson(string firstName, string lastName, int age)
        {
            Person person = new Person
            {
                FirstName = firstName,
                LastName  = lastName,
                Age       = age
            };
            PeopleDb db = new PeopleDb(_connectionString);

            db.Add(person);
            return(Redirect("/postdemo/showpeople"));
        }