public async Task <IActionResult> Edit(int id, [Bind("Id,StudentID,EventID,Date,Title,PostMessage")] 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)));
            }
            ViewData["EventID"]   = new SelectList(_context.Events, "Id", "Id", post.EventID);
            ViewData["StudentID"] = new SelectList(_context.Students, "Id", "Course", post.StudentID);
            return(View(post));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,Location,Image")] Event @event)
        {
            if (id != @event.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@event);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventExists(@event.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(@event));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,AdminID,Title,Date,Message")] Notification notification)
        {
            if (id != notification.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(notification);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NotificationExists(notification.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(notification));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Course,Password,Email")] Student student)
        {
            if (id != student.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
示例#5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AdminID,Name,Chairperson,Secretary,Treasurer,Phone,Email,Description")] ClubsAndSociety clubsAndSociety)
        {
            if (id != clubsAndSociety.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clubsAndSociety);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClubsAndSocietyExists(clubsAndSociety.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clubsAndSociety));
        }