示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("EmailID,ElectonicMail,isActive,UserId")] Email email)
        {
            if (id != email.EmailID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(email);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmailExists(email.EmailID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Set <User>(), "UserId", "UserId", email.UserId);
            return(View(email));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("PhoneId,LandLineNumber,MobileNumber,isUsingWhatsApp,UserId")] Phone phone)
        {
            if (id != phone.PhoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(phone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PhoneExists(phone.PhoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Set <User>(), "UserId", "UserId", phone.UserId);
            return(View(phone));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Name")] User user)
        {
            if (id != user.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("AddrId,HouseNO,Street,State,PostalCode,Country,UserId")] Address address)
        {
            if (id != address.AddrId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(address);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AddressExists(address.AddrId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Set <User>(), "UserId", "UserId", address.UserId);
            return(View(address));
        }