Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ElectricityConnectionId,LocationName,ConnectioName,City,State,PinCode,ConsumerNumber,ConusumerId,Connection,ConnectinDate,DisconnectionDate,KVLoad,OwnedMetter,TotalConnectionCharges,SecurityDeposit,Remarks,StoreId,UserId,IsReadOnly")] ElectricityConnection electricityConnection)
        {
            if (id != electricityConnection.ElectricityConnectionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(electricityConnection);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ElectricityConnectionExists(electricityConnection.ElectricityConnectionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName", electricityConnection.StoreId);
            return(View(electricityConnection));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutElectricityConnection(int id, ElectricityConnection electricityConnection)
        {
            if (id != electricityConnection.ElectricityConnectionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 3
0
 private bool AllLightBulbsOff()
 {
     foreach (GameObject lightBulb in lightBulbs)
     {
         ElectricityConnection electricityConnection = lightBulb.GetComponent <ElectricityConnection>();
         if (electricityConnection.activated)
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("ElectricityConnectionId,LocationName,ConnectioName,City,State,PinCode,ConsumerNumber,ConusumerId,Connection,ConnectinDate,DisconnectionDate,KVLoad,OwnedMetter,TotalConnectionCharges,SecurityDeposit,Remarks,StoreId,UserId,IsReadOnly")] ElectricityConnection electricityConnection)
        {
            if (ModelState.IsValid)
            {
                _context.Add(electricityConnection);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName", electricityConnection.StoreId);
            return(View(electricityConnection));
        }
Exemplo n.º 5
0
        public async Task <ActionResult <ElectricityConnection> > PostElectricityConnection(ElectricityConnection electricityConnection)
        {
            _context.ElectricityConnections.Add(electricityConnection);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetElectricityConnection", new { id = electricityConnection.ElectricityConnectionId }, electricityConnection));
        }