public async Task <ActionResult <int> > DeleteEmployee(string email) { Employee employee = new Employee(); employee.Email = email; return(await _employeeRepo.Delete(employee)); }
public void Delete(int id) { var foundEmployee = _repository.GetById(id); if (foundEmployee == null) { throw new ArgumentNullException(nameof(foundEmployee)); } _repository.Delete(foundEmployee); }
public ActionResult Delete(int id, Employee employee) { try { employeeRepo.Delete(id); return(RedirectToAction("Index")); } catch { return(View(employee)); } }
public async Task <ActionResult <HttpStatusCode> > DeleteEmployee(Users user) { try { Employee employee = new Employee(); employee.Email = user.Email; var employeeDetail = await _employeeRepo.Delete(employee); return(HttpStatusCode.OK); } catch (Exception ex) { throw; } return(HttpStatusCode.OK); }
public IActionResult DeleteEmployee(string id) { Guid employeeId; if (!Guid.TryParse(id, out employeeId)) { return(BadRequest(new ErrorMessageDTO("Incorret employee id format", 101))); } if (!_employeeRepo.Delete(employeeId)) { return(NotFound(new ErrorMessageDTO($"Cannot find user of id {id}", 101))); } return(Ok()); }
public ActionResult Delete(EmployeeDeleteViewModel model) { Employee findPreviousEmp = _empRepo.GetEmployee(model.ID); if (findPreviousEmp != null) { if (findPreviousEmp.PhotoPath != null) { //After Deleting the Image from the Database _empRepo.Delete(findPreviousEmp.ID); //Delete the Image form the Server var path = Path.Combine(_webHostEnvironment.WebRootPath, "images", findPreviousEmp.PhotoPath); System.IO.File.Delete(path); return(RedirectToAction("Programming", "Welcome")); } } return(View("EmployeeNotFound", model.ID)); }
public IActionResult Delete([FromBody] Employee DeleteEmployee) { var retval = repo.Delete(DeleteEmployee.Id); return(StatusCode(StatusCodes.Status200OK, retval)); }
public async Task DeleteEmployee(Guid id) { await _repo.Delete(id); }
public Employee DeleteEmployee(long id) { return(_employeeRepo.Delete(id)); }
public IActionResult DeleteEmployee(int id) { employeeRepo.Delete(id); return(RedirectToAction("ViewEmployee")); }
public void DeleteEmployee(int id) { EmployeeRepo.Delete(id); }
// DELETE: api/Employees/5 public bool Delete(int id) { return(_repo.Delete(id)); }