Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] TeamsModel teamsModel)
        {
            if (id != teamsModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teamsModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamsModelExists(teamsModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(teamsModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,DateSent,UserId,FromDate,UntilDate,LeaveId,HalfDay,AttachmentUrl,Approved")] RequestsModel requestsModel)
        {
            if (id != requestsModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(requestsModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RequestsModelExists(requestsModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(requestsModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Username,PasswordHash,FirstName,LastName")] UsersModel usersModel)
        {
            if (id != usersModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(usersModel);
                    await _context.SaveChangesAsync();
                }

                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersModelExists(usersModel.Id))
                    {
                        return(NotFound());
                    }

                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(usersModel));
        }