示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Url")] Urls urls)
        {
            if (id != urls.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(urls);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UrlsExists(urls.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(urls));
        }
示例#2
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Title,StartDate,DueDate,IsComplete")] Tasks tasks)
        {
            if (id != tasks.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tasks);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TasksExists(tasks.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tasks));
        }
示例#3
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,UserName,Password,DateOfBirth,FirstName,LastName,Location,Email,PhoneNumber,DateJoined,Bio,LinkedInURL,GitHubURL,ForumPriv")] 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)));
            }
            return(View(user));
        }