Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeMajorId,Code,Name,CreateBy,CreateDate,UpdateBy,UpdateDate,IsActive,IsDelete")] EmployeeMajor employeeMajor)
        {
            if (id != employeeMajor.EmployeeMajorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeMajor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeMajorExists(employeeMajor.EmployeeMajorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeMajor));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("EmployeeMajorId,Code,Name,CreateBy,CreateDate,UpdateBy,UpdateDate,IsActive,IsDelete")] EmployeeMajor employeeMajor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeMajor);
                await _context.SaveChangesAsync();

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