Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id_LineHydrocarbon,Name_Line,Length_Line,Diameter_Line,InstalationDate")] Line_Hydrocarbon line_Hydrocarbon)
        {
            if (id != line_Hydrocarbon.Id_LineHydrocarbon)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(line_Hydrocarbon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Line_HydrocarbonExists(line_Hydrocarbon.Id_LineHydrocarbon))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(line_Hydrocarbon));
        }
Example #2
0
        public async Task <ActionResult <Line_Hydrocarbon> > PostLine_Hydrocarbon(Line_Hydrocarbon line_Hydrocarbon)
        {
            _context.Line_Hydrocarbons.Add(line_Hydrocarbon);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLine_Hydrocarbon", new { id = line_Hydrocarbon.Id_LineHydrocarbon }, line_Hydrocarbon));
        }
Example #3
0
        public async Task <IActionResult> PutLine_Hydrocarbon(int id, Line_Hydrocarbon line_Hydrocarbon)
        {
            if (id != line_Hydrocarbon.Id_LineHydrocarbon)
            {
                return(BadRequest());
            }

            _context.Entry(line_Hydrocarbon).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Line_HydrocarbonExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("Id_LineHydrocarbon,Name_Line,Length_Line,Diameter_Line,InstalationDate")] Line_Hydrocarbon line_Hydrocarbon)
        {
            if (ModelState.IsValid)
            {
                _context.Add(line_Hydrocarbon);
                await _context.SaveChangesAsync();

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