Пример #1
0
        public async Task <IActionResult> Editpopup(int id, [Bind("EmployeeId,Name,Surname,Birthday,GenderId,PositionId")] Employees employees)
        {
            if (id != employees.EmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employees);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeesExists(employees.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GenderId"]   = new SelectList(_context.MasterGender, "GenderId", "GenderId", employees.GenderId);
            ViewData["PositionId"] = new SelectList(_context.MasterPosition, "PositionId", "PositionId", employees.PositionId);
            return(View(employees));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,JobDescription,Number,Department,HourlyPay,Bonus,EmployeeTypeID")] EmployeeSystemDesignPatterns.Models.EmployeeModels.Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #3
0
        public ActionResult UpdateEmployee(Employee employee)
        {
            var result = _dBContext.Employees.Where(x => x.EmpId == employee.EmpId).FirstOrDefault();

            if (result != null)
            {
                employee = new Employee()
                {
                    EmpId         = employee.EmpId,
                    FirstName     = employee.FirstName,
                    LastName      = employee.LastName,
                    Email         = employee.Email,
                    Qualificaton  = employee.Qualificaton,
                    Gender        = employee.Gender,
                    MobileNumber  = employee.MobileNumber,
                    DateOfBirth   = employee.DateOfBirth,
                    DateOfJoining = employee.DateOfJoining,
                    DeptId        = employee.DeptId
                };
                _dBContext.Update(employee);
                _dBContext.SaveChanges();
                return(Ok(employee));
            }
            return(NoContent());
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("EmpId,FirstName,LastName,Designation,Position,Office")] Employee employee)
        {
            if (id != employee.EmpId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmpId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,FirstName,LastName,Gender,PhoneNumber,EmailID,PostalCode,Retired,StateName")] Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #6
0
        public async Task <IActionResult> Put(int id, Employee employee)
        {
            if (id != employee.Id)
            {
                return(BadRequest());
            }

            if (!EmployeeExists(id))
            {
                return(NotFound());
            }
            //_context.Entry<Employee>(employee).State = EntityState.Detached;

            try
            {
                _context.Update <Employee>(employee);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException) when(!EmployeeExists(id))
            {
                return(NotFound());
            }

            return(Content("Updated Successfully..."));
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,EmpName,EmpAddress,ContactNum")] TblEmp tblEmp)
        {
            if (id != tblEmp.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblEmp);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblEmpExists(tblEmp.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblEmp));
        }
Пример #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,MiddleName,FullName,Salaray,AddressId,Gender")] Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #9
0
        public async Task <IActionResult> Edit(int id, [Bind("TeacherId,TeacherName,TeacherDept")] TeacherDb teacherDb)
        {
            if (id != teacherDb.TeacherId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teacherDb);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeacherDbExists(teacherDb.TeacherId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(teacherDb));
        }
Пример #10
0
        public async Task <IActionResult> Edit(EmployeeModel _empModel)
        {
            if (ModelState.IsValid)
            {
                _db.Update(_empModel);
                await _db.SaveChangesAsync();

                return(RedirectToAction("index"));
            }
            return(View(_empModel));
        }
Пример #11
0
 public bool Update(Employee employee)
 {
     EmployeeDBContext.Update <Employee>(employee);
     EmployeeDBContext.SaveChanges();
     return(true);
 }
Пример #12
0
 public bool Update(Employee employee)
 {
     return(context.Update(employee));
 }
Пример #13
0
        //public bool RevokeToken(string refreshtoken, string ipAddress)
        //{
        //    var revokedToken = EmployeeDBContext.RefreshTokens.SingleAsync(x => x.Token == refreshtoken && x.CreatedByIp) != null ? true : false;
        //    return

        //}

        public bool Update(User user)
        {
            EmployeeDBContext.Update <User>(user);
            EmployeeDBContext.SaveChanges();
            return(true);
        }