Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("InitX,X,InitY,Y,Period,Id")] Incl incl)
        {
            if (id != incl.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(incl);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InclExists(incl.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(incl));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("InitValue,Value,Period,Id")] Gap gap)
        {
            Gap currGap = new Gap();

            if (id != gap.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    currGap = await _context.Gap.FindAsync(gap.Id);

                    currGap.Period = gap.Period;
                    _context.Update(currGap);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GapExists(gap.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(currGap));
        }