Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("PriceTypeId,Name,Description,IsActive,CreatedAt,CreatedBy,UpdatedAt,UpdatedBy")] Pricetype pricetype)
        {
            if (id != pricetype.PriceTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pricetype);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PricetypeExists(pricetype.PriceTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pricetype));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("PriceTypeId,Name,Description,IsActive,CreatedAt,CreatedBy,UpdatedAt,UpdatedBy")] Pricetype pricetype)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pricetype);
                await _context.SaveChangesAsync();

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