public async Task <IActionResult> Create([Bind("Id,Title,Price,Description")] Service service)
        {
            if (ModelState.IsValid)
            {
                _context.Add(service);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(service));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Address,Phone,EmailAddress")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("Id,UserId,SerialNbr,Type,Make,Model")] Device device)
        {
            if (ModelState.IsValid)
            {
                _context.Add(device);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Name", device.UserId);
            return(View(device));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,DeviceId,ServiceId,DateStarted,DateCompleted,Comments")] DeviceService deviceService)
        {
            if (ModelState.IsValid)
            {
                _context.Add(deviceService);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["DeviceId"]  = new SelectList(_context.Devices, "Id", "SerialNbr", deviceService.DeviceId);
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Title", deviceService.ServiceId);
            return(View(deviceService));
        }