Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Location location)
        {
            if (ModelState.IsValid)
            {
                _context.Add(location);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Brand,Model,PrinterType,Serial,PersonInCharge,LocationId,Id,Name")] Printer printer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(printer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocationId"] = new SelectList(_context.Set <Location>(), "Id", "Id", printer.LocationId);
            return(View(printer));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Date,Technician,PrinterId,LocationId,Id,Name")] Maintenance maintenance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(maintenance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocationId"] = new SelectList(_context.Location, "Id", "Id", maintenance.LocationId);
            ViewData["PrinterId"]  = new SelectList(_context.Printer, "Id", "Id", maintenance.PrinterId);
            return(View(maintenance));
        }