Пример #1
0
        public async Task <IActionResult> Create([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>("Admin")))
            //{
            if (ModelState.IsValid)
            {
                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.Add(newCircuit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(circuit));
            //}
            //else { return NotFound(); }
        }
Пример #2
0
        public async Task <IActionResult> Index(/*[Bind("ID,MaintenanceDate,Scheduled,MaintenanceTime")]*/ AdminView admin)
        {
            if (ModelState.IsValid)
            {
                if (_context.AdminSettings.ToList().Count() != 0)
                {
                    foreach (var item in _context.AdminSettings.ToList())
                    {
                        _context.Remove(_context.AdminSettings.Single(m => m.ID == item.ID));
                        await _context.SaveChangesAsync();
                    }
                }
                AdminSettings AS = new AdminSettings
                {
                    MaintenanceDate = admin.settingsAdmin.MaintenanceDate,
                    MaintenanceTime = admin.settingsAdmin.MaintenanceTime,
                    Scheduled       = admin.settingsAdmin.Scheduled,
                };

                await _context.AddAsync(AS);

                await _context.SaveChangesAsync();

                AdminSettings.MaintenaceInfo     = admin.settingsAdmin.MaintenanceDate;
                AdminSettings.ScheduledBool      = admin.settingsAdmin.Scheduled;
                AdminSettings.MaintenaceTimeInfo = admin.settingsAdmin.MaintenanceTime;

                //Handle the other views here?

                return(RedirectToAction("Index"));
            }
            return(View(admin));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("ID,Manufacturer,SoftwareTitle,AssignedTo,PurchaseOrder,LicenseType,PurchaseDate,Supported,SupportExp,TotalKeys,UsedKeys,LicenseKey,added")] Software software)
        {
            if (ModelState.IsValid)
            {
                software.added = DateTime.UtcNow;
                _context.Add(software);
                await _context.SaveChangesAsync();

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