示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("TaskId,TaskName,TaskDescription,done")] Models.Task task)
        {
            if (id != task.TaskId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(task);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TaskExists(task.TaskId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(task));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("EventId,EventName,EventDescription,EventType,ReleaseDate")] Event @event)
        {
            if (id != @event.EventId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@event);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventExists(@event.EventId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(@event));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("TimeProposedId,StartTime,EndTime")] TimeProposed timeProposed)
        {
            if (id != timeProposed.TimeProposedId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(timeProposed);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TimeProposedExists(timeProposed.TimeProposedId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(timeProposed));
        }
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Name,Password,CompanyId")] 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));
        }
        public async Task <IActionResult> Edit(int id, [Bind("InviteeId,Name")] Invitee invitee)
        {
            if (id != invitee.InviteeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(invitee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InviteeExists(invitee.InviteeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(invitee));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ActivityId,Name,Description")] Activity activity)
        {
            if (id != activity.ActivityId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(activity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ActivityExists(activity.ActivityId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(activity));
        }
示例#7
0
        public async Task <IActionResult> Edit(int id, [Bind("CompanyId,Name,Description,UserId")] Company company)
        {
            if (id != company.CompanyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.CompanyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.users, "UserId", "UserId", company.UserId);
            return(View(company));
        }
示例#8
0
        //public void UpdateById(int id)
        //{
        //    _context.Find(id);
        //    _context.Update(updateEvent);
        //    _context.SaveChanges();

        //}

        public void UpdateByEntity(Event @event)
        {
            _context.Update(@event);
            _context.SaveChanges();
        }