Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("TopicId,TopicTitle,TopicDescription")] Topics topics)
        {
            if (id != topics.TopicId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(topics);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TopicsExists(topics.TopicId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(topics));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ThreadId,UserId,TopicId,ThreadTitle,ThreadIsLocked")] Threads threads)
        {
            if (id != threads.ThreadId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(threads);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ThreadsExists(threads.ThreadId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TopicId"] = new SelectList(_context.Topics, "TopicId", "TopicTitle", threads.TopicId);
            ViewData["UserId"]  = new SelectList(_context.Users, "UserId", "UserEmail", threads.UserId);
            return(View(threads));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,UserName,UserEmail,UserPassword,UserRegistrationDate,UserBirthdate,UserLastOnline,UserIsAdmin")] Users users)
        {
            if (id != users.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("MessagesId,MessageContents,MessageCreationDate,MessageModificationDate,UserId,ThreadId")] Messages messages)
        {
            if (id != messages.MessagesId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(messages);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MessagesExists(messages.MessagesId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ThreadId"] = new SelectList(_context.Threads, "ThreadId", "ThreadTitle", messages.ThreadId);
            ViewData["UserId"]   = new SelectList(_context.Users, "UserId", "UserEmail", messages.UserId);
            return(View(messages));
        }