Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Manufacturer,SoftwareTitle,AssignedTo,PurchaseOrder,LicenseType,PurchaseDate,Supported,SupportExp,TotalKeys,UsedKeys,LicenseKey,added")] Software software)
        {
            if (id != software.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    software.added = DateTime.UtcNow;
                    _context.Update(software);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SoftwareExists(software.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(software));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,CCSD,Domain,CKT_Type,Source,SInt,SIP,Destination,DInt,DIP,CCO,Phone,Date,user")] Circuit circuit)
        {
            //if (ClaimsLoader.IsInGroup(User, _config.GetValue<string>("Modify")) || ClaimsLoader.IsInGroup(User, _config.GetValue<string>("Admin")))
            //{
            if (id != circuit.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Circuit newCircuit = new Circuit
                    {
                        ID          = circuit.ID,
                        CCSD        = circuit.CCSD,
                        Domain      = circuit.Domain,
                        CKT_Type    = circuit.CKT_Type,
                        Source      = circuit.Source,
                        SInt        = circuit.SInt,
                        SIP         = circuit.SIP,
                        Destination = circuit.Destination,
                        DInt        = circuit.DInt,
                        DIP         = circuit.DIP,
                        CCO         = circuit.CCO,
                        Phone       = circuit.Phone,
                        Date        = DateTime.UtcNow,
                        user        = User.Identity.Name
                    };

                    _context.Update(newCircuit);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CircuitExists(circuit.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(circuit));
            //}
            //else { return NotFound(); }
        }