示例#1
0
        public async Task <IActionResult> Create([Bind("UserId,Name")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("EmailID,ElectonicMail,isActive,UserId")] Email email)
        {
            if (ModelState.IsValid)
            {
                _context.Add(email);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Set <User>(), "UserId", "UserId", email.UserId);
            return(View(email));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("PhoneId,LandLineNumber,MobileNumber,isUsingWhatsApp,UserId")] Phone phone)
        {
            if (ModelState.IsValid)
            {
                _context.Add(phone);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Set <User>(), "UserId", "UserId", phone.UserId);
            return(View(phone));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("AddrId,HouseNO,Street,State,PostalCode,Country,UserId")] Address address)
        {
            if (ModelState.IsValid)
            {
                _context.Add(address);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Set <User>(), "UserId", "UserId", address.UserId);
            return(View(address));
        }