Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("DepartmentTypeId,DepartmentTypeValue,DepartmentTypeDescription")] Departmenttype departmenttype)
        {
            if (id != departmenttype.DepartmentTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departmenttype);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmenttypeExists(departmenttype.DepartmentTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(departmenttype));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("DepartmentTypeId,DepartmentTypeValue,DepartmentTypeDescription")] Departmenttype departmenttype)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departmenttype);
                await _context.SaveChangesAsync();

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