Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OptionName,Charge")] HairDressingOption hairDressingOption)
        {
            if (id != hairDressingOption.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hairDressingOption);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HairDressingOptionExists(hairDressingOption.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hairDressingOption));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,OptionName,Charge")] HairDressingOption hairDressingOption)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hairDressingOption);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hairDressingOption));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            HairDressingOption = await _context.HairDressingOption.FirstOrDefaultAsync(m => m.Id == id);

            if (HairDressingOption == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            HairDressingOption = await _context.HairDressingOption.FindAsync(id);

            if (HairDressingOption != null)
            {
                _context.HairDressingOption.Remove(HairDressingOption);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }