Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CopperCablesTypeId,CableSize,Material,NumbersAndDiameterofWires,MaximumResistanceat30degC,NominalThicknessofInsulation,NominalThicknessofSheath,ColorofSheath,ApproximateOuterDiameter,ApproximateWeight,ContinuousPermissibleServiceVoltage,CurrentRatingAt30degCambientTemperatureUorG,CurrentRatingat35degCambientinAir,PoleId")] TblCopperCables tblCopperCables)
        {
            if (id != tblCopperCables.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblCopperCables);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblCopperCablesExists(tblCopperCables.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PoleId"]             = new SelectList(_context.TblPole, "PoleId", "PoleId", tblCopperCables.PoleId);
            ViewData["CopperCablesTypeId"] = new SelectList(_context.LookUpCopperCablesType, "CopperCablesTypeId", "CopperCablesTypeName", tblCopperCables.CopperCablesTypeId);
            return(View(tblCopperCables));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,CopperCablesTypeId,CableSize,Material,NumbersAndDiameterofWires,MaximumResistanceat30degC,NominalThicknessofInsulation,NominalThicknessofSheath,ColorofSheath,ApproximateOuterDiameter,ApproximateWeight,ContinuousPermissibleServiceVoltage,CurrentRatingAt30degCambientTemperatureUorG,CurrentRatingat35degCambientinAir,PoleId")] TblCopperCables tblCopperCables)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblCopperCables);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PoleId"]             = new SelectList(_context.TblPole, "PoleId", "PoleId", tblCopperCables.PoleId);
            ViewData["CopperCablesTypeId"] = new SelectList(_context.LookUpCopperCablesType, "CopperCablesTypeId", "CopperCablesTypeName", tblCopperCables.CopperCablesTypeId);
            return(View(tblCopperCables));
        }