Example #1
0
        public async Task <IActionResult> Edit(long id, [Bind("Id_founder,Inn_uch,Fio,Date_add,Date_reload")] founder founder)
        {
            if (id != founder.Inn_uch)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(founder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!founderExists(founder.Inn_uch))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id_founder"] = new SelectList(_context.Clients, "Id_clients", "Name_corp", founder.Id_founder);
            return(View(founder));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id_founder,Inn_uch,Fio,Date_add,Date_reload")] founder founder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(founder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id_founder"] = new SelectList(_context.Clients, "Id_clients", "Name_corp", founder.Id_founder);
            return(View(founder));
        }