Ejemplo n.º 1
0
        public JsonResult Edit([FromForm] CityForm cityForm)
        {
            City city = _context.Cities.FirstOrDefault(u => u.Id == cityForm.Id);

            city.Name       = cityForm.Name;
            city.PostalCode = cityForm.PostalCode;

            _context.SaveChanges();
            return(Json(city));
        }
Ejemplo n.º 2
0
        public JsonResult Add([FromForm] CityForm cityForm)
        {
            City city = new City();

            city.Name       = cityForm.Name;
            city.PostalCode = cityForm.PostalCode;

            //add user to database in order to generate id;
            _context.Cities.Add(city);
            _context.SaveChanges();

            return(Json(city));
        }
Ejemplo n.º 3
0
        private void добавить√ородToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CityForm cityForm = new CityForm();

            cityForm.ShowDialog();
        }