Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("EquipamentoId,NomeEquipamento,QuantidadeEquip,DescricaoEquipamento,ValorUnidade,Disponível")] Equipamento equipamento)
        {
            if (id != equipamento.EquipamentoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(equipamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EquipamentoExists(equipamento.EquipamentoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(equipamento));
        }
        public async Task <IActionResult> Edit(int id, [Bind("LinhaEquipamentoId,EquipamentoId,ReservaId,Quantidade,ValorParcial")] Linha_Equipamento_Reserva linha_Equipamento_Reserva)
        {
            if (id != linha_Equipamento_Reserva.ReservaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(linha_Equipamento_Reserva);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Linha_Equipamento_ReservaExists(linha_Equipamento_Reserva.ReservaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EquipamentoId"] = new SelectList(_context.Equipamento, "EquipamentoId", "EquipamentoId", linha_Equipamento_Reserva.EquipamentoId);
            ViewData["ReservaId"]     = new SelectList(_context.ReservaEquipamentos, "ReservaId", "ReservaId", linha_Equipamento_Reserva.ReservaId);
            return(View(linha_Equipamento_Reserva));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("TuristaId,username,Pass,Nome,Numero_Telefone,Morada")] LoginClass loginClass)
        {
            if (id != loginClass.TuristaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loginClass);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoginClassExists(loginClass.TuristaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(loginClass));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DifficultyId,Name")] Difficulty difficulty)
        {
            if (id != difficulty.DifficultyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(difficulty);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DifficultyExists(difficulty.DifficultyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(difficulty));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ReservaId,TuristaId,TrilhoId,Data_Reserva_Efetuada,Inicio_Reserva")] ReservaEquipamentos reservaEquipamentos)
        {
            if (id != reservaEquipamentos.ReservaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reservaEquipamentos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReservaEquipamentosExists(reservaEquipamentos.ReservaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(View)));
            }
            ViewData["TrilhoId"]  = new SelectList(_context.Trails, "TrailID", "TrailID", reservaEquipamentos.TrilhoId);
            ViewData["TuristaId"] = new SelectList(_context.Turistas, "TuristaId", "TuristaId", reservaEquipamentos.TuristaId);
            return(View(reservaEquipamentos));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TrailID,Name,Distance,DifficultyId,Available")] Trail trail)
        {
            if (id != trail.TrailID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trail);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrailExists(trail.TrailID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DifficultyId"] = new SelectList(_context.Difficulties, "DifficultyId", "Name", trail.DifficultyId);
            return(View(trail));
        }