예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,RelatingUserId,RelatedUserId,RequestStatus,RelationshipStatus,DateOfRequest,DateOfAcceptance")] UserRelationship userRelationship)
        {
            if (id != userRelationship.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userRelationship);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserRelationshipExists(userRelationship.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RelatedUserId"]  = new SelectList(_context.User, "Id", "Email", userRelationship.RelatedUserId);
            ViewData["RelatingUserId"] = new SelectList(_context.User, "Id", "Email", userRelationship.RelatingUserId);
            return(View(userRelationship));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,UserEmail,Message,PhotoUrl")] Post post)
        {
            if (id != post.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(post);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PostExists(post.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(post));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Question")] SecurityQuestion securityQuestion)
        {
            if (id != securityQuestion.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(securityQuestion);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SecurityQuestionExists(securityQuestion.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(securityQuestion));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CityName,CountryID")] City city)
        {
            if (id != city.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(city);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CityExists(city.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryID"] = new SelectList(_context.Country, "Id", "CountryName", city.CountryID);
            return(View(city));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CommunityName,OwnerId,CreationDate,Status")] Community community)
        {
            if (id != community.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(community);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommunityExists(community.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OwnerId"] = new SelectList(_context.User, "Id", "Email", community.OwnerId);
            return(View(community));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Phone,Gender,Age,Email,Password,UserType,DateOfBirth,ProfileImage,ProfilePicture,SecurityQuestionAnswer,SecurityQuestionID,CityID,CountryID")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityID"]             = new SelectList(_context.City, "Id", "CityName", user.CityID);
            ViewData["CountryID"]          = new SelectList(_context.Country, "Id", "CountryName", user.CountryID);
            ViewData["SecurityQuestionID"] = new SelectList(_context.SecurityQuestion, "Id", "Question", user.SecurityQuestionID);
            return(View("Details", user.Id));
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CountryName")] Country country)
        {
            if (id != country.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(country));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,CommunityId,DateOfJoining,Status")] CommunityMember communityMember)
        {
            if (id != communityMember.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(communityMember);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommunityMemberExists(communityMember.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Communities"));
            }
            ViewData["CommunityId"] = new SelectList(_context.Community, "Id", "CommunityName", communityMember.CommunityId);
            ViewData["UserId"]      = new SelectList(_context.User, "Id", "Email", communityMember.UserId);
            return(View("Index", "Community"));
        }