Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,Calss,CountPlace,PlaceType,ImgsrcOutside,ImgsrcOutside")] PassangerCarriere passangerCarriere)
        {
            if (id != passangerCarriere.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(passangerCarriere);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PassangerCarriereExists(passangerCarriere.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(passangerCarriere));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("id,Calss,CountPlace,PlaceType,ImgsrcOutside,ImgsrcInside")] PassangerCarriere passangerCarriere)
        {
            if (ModelState.IsValid)
            {
                _context.Add(passangerCarriere);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(passangerCarriere));
        }
        // GET: PassangerCarriegesInfoes/Details/5
        public async Task <IActionResult> Details(int?idcar)
        {
            if (idcar == null)
            {
                return(NotFound());
            }

            PassangerCarriere passangerCarriere = await _context.PassangerCarrieres.Where(x => x.id == idcar).FirstOrDefaultAsync();

            var passanger_carrieges_info = _context.PassangerCarriegesInfos.Where(m => m.Type == passangerCarriere.Calss).FirstOrDefault();

            if (passanger_carrieges_info == null)
            {
                PassangerCarriegesInfo passangerCarriegesInfo = new PassangerCarriegesInfo
                {
                    Type = passangerCarriere.Calss,
                    Info = ""
                };
                _context.Add(passangerCarriegesInfo);
                Trace.WriteLine("POST: " + passangerCarriegesInfo);
                await _context.SaveChangesAsync();
            }
            PassangerCarriegesInfo passangerCarriegesInfo_result;

            try
            {
                passangerCarriegesInfo_result = _context.PassangerCarriegesInfos.Where(m => m.Type == passangerCarriere.Calss).FirstOrDefault();
                if (passangerCarriegesInfo_result == null)
                {
                    return(View(Details(idcar)));
                }
            }
            catch (Exception exp)
            {
                return(NotFound());
            }
            Trace.WriteLine("RESPONSE: " + passangerCarriegesInfo_result);
            return(View(passangerCarriegesInfo_result));
        }