Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Plaque")] gastoEntity gastoEntity)
        {
            if (id != gastoEntity.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gastoEntity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!gastoEntityExists(gastoEntity.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(gastoEntity));
        }
Пример #2
0
        public async Task <IActionResult> Create(gastoEntity gastoEntity)
        {
            if (ModelState.IsValid)
            {
                gastoEntity.Plaque = gastoEntity.Plaque.ToUpper();
                _context.Add(gastoEntity);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(gastoEntity));
        }