Example #1
0
        // POST: Values/Edit/5
        public async Task <ActionResult <Value> > Edit(string id, [FromBody] Value value)
        {
            if (id != value.ValueID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(value);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ValueExists(value.ValueID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(value);
        }
        public async Task <ActionResult <Currency> > Edit(string id, [FromBody] Currency currency)
        {
            if (id != currency.CurrencyID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(currency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CurrencyExists(currency.CurrencyID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(CreatedAtAction(nameof(Index), currency));
            }
            return(currency);
        }