Esempio n. 1
0
 public FormCattery(string title, FormMain.FormCatInfoModes mode, Cattery cattery)
 {
     InitializeComponent();
     this.mode    = mode;
     this.Text    = title;
     this.cattery = cattery;
 }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Adress,CityId,Capacity")] Cattery cattery)
        {
            if (id != cattery.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cattery);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CatteryExists(cattery.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", cattery.CityId);
            return(View(cattery));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Adress,CityId,Capacity")] Cattery cattery)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cattery);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", cattery.CityId);
            return(View(cattery));
        }