Exemple #1
0
        public async Task <IActionResult> Edit(string id, [Bind("ServicesPointId,PoleId,DistributionTransformerId,VoltageCategoryId,TransformerNumber,ServicePointTypeId,AggregateLoadkw,NoOFConsumersR,NoOFConsumersY,NoOFConsumersB,NoOfConsumersRyb,RoadName,VillageOrAreaName,Ward,CityTown,PrimaryLandmark")] TblServicePoint tblServicePoint)
        {
            if (id != tblServicePoint.ServicesPointId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblServicePoint);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblServicePointExists(tblServicePoint.ServicesPointId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                TempData["statuMessageSuccess"] = "Service Point Information has been updated successfully";
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["PoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblServicePoint.PoleId);
            ViewData["ServicePointTypeId"] = new SelectList(_context.LookUpServicePointType, "ServicePointTypeId", "ServicePointTypeName", tblServicePoint.ServicePointTypeId);
            ViewData["VoltageCategoryId"]  = new SelectList(_context.LookUpVoltageCategory, "VoltageCategoryId", "VoltageCategoryName", tblServicePoint.VoltageCategoryId);
            return(View(tblServicePoint));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ServicesPointId,PoleId,DistributionTransformerId,VoltageCategoryId,TransformerNumber,ServicePointTypeId,AggregateLoadkw,NoOFConsumersR,NoOFConsumersY,NoOFConsumersB,NoOfConsumersRyb,RoadName,VillageOrAreaName,Ward,CityTown,PrimaryLandmark")] TblServicePoint tblServicePoint)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblServicePoint);
                await _context.SaveChangesAsync();

                TempData["statuMessageSuccess"] = "Service Point Information has been added successfully";
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["PoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblServicePoint.PoleId);
            ViewData["ServicePointTypeId"] = new SelectList(_context.LookUpServicePointType, "ServicePointTypeId", "ServicePointTypeName", tblServicePoint.ServicePointTypeId);
            ViewData["VoltageCategoryId"]  = new SelectList(_context.LookUpVoltageCategory, "VoltageCategoryId", "VoltageCategoryName", tblServicePoint.VoltageCategoryId);
            ViewData["ZoneCode"]           = new SelectList(_context.LookUpZoneInfo.OrderBy(d => d.ZoneCode), "ZoneCode", "ZoneName");
            return(View(tblServicePoint));
        }