Exemplo n.º 1
0
		public IActionResult Edit(Employee employee)
		{
			if (ModelState.IsValid)
			{
				_employeeRepository.Update(employee);
				return RedirectToAction("Index");
			}

			return View("Edit", employee);
		}
Exemplo n.º 2
0
		public IActionResult Create(Employee employee)
		{
			if (ModelState.IsValid)
			{
				_employeeRepository.Save(employee);
				return RedirectToAction("Index");
			}

			return View("Create", employee);
		}
Exemplo n.º 3
0
		public async Task Update(Employee employee)
		{
			_employeeContext.Employees.Update(employee);
			await _employeeContext.SaveChangesAsync();
		}
Exemplo n.º 4
0
		public async Task Delete(Employee employee)
		{
			_employeeContext.Employees.Remove(employee);
			 await _employeeContext.SaveChangesAsync();
		}
Exemplo n.º 5
0
		public async Task Save(Employee employee)
		{
			 _employeeContext.Employees.Add(employee);
			 await _employeeContext.SaveChangesAsync();
		}