Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PicturePath")] Picture picture)
        {
            if (id != picture.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(picture);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PictureExists(picture.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(picture));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,FirstName,LastName,Patronymic,Email,Salary,PicturePathId")] Workers workers)
        {
            if (id != workers.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkersExists(workers.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PicturePathId"] = new SelectList(_context.Picture, "Id", "Id", workers.PicturePathId);
            return(View(workers));
        }