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));
        }
        public async Task <IActionResult> Create([Bind("Id,DateSent,UserId,FromDate,UntilDate,LeaveId,HalfDay,AttachmentUrl,Approved")] RequestsModel requestsModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(requestsModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(requestsModel));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Name")] TeamsModel teamsModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(teamsModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(teamsModel));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,TeamId")] ProjectsModel projectsModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(projectsModel);
                await _context.SaveChangesAsync();

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