예제 #1
0
        public async Task <IActionResult> Edit(decimal id, [Bind("Id,Tip,Producator,UnitateDeMasura,CantitateUm,PretUm")] Inputuri inputuri)
        {
            if (id != inputuri.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inputuri);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InputuriExists(inputuri.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(inputuri));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Tip,Producator,UnitateDeMasura,CantitateUm,PretUm")] Inputuri inputuri)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inputuri);
                await _context.SaveChangesAsync();

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