public async Task <ActionResult <int> > DeleteEmployee(string email)
        {
            Employee employee = new Employee();

            employee.Email = email;
            return(await _employeeRepo.Delete(employee));
        }
Ejemplo n.º 2
0
        public void Delete(int id)
        {
            var foundEmployee = _repository.GetById(id);

            if (foundEmployee == null)
            {
                throw new ArgumentNullException(nameof(foundEmployee));
            }
            _repository.Delete(foundEmployee);
        }
Ejemplo n.º 3
0
 public ActionResult Delete(int id, Employee employee)
 {
     try
     {
         employeeRepo.Delete(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(employee));
     }
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 8
0
 public async Task DeleteEmployee(Guid id)
 {
     await _repo.Delete(id);
 }
Ejemplo n.º 9
0
 public Employee DeleteEmployee(long id)
 {
     return(_employeeRepo.Delete(id));
 }
 public IActionResult DeleteEmployee(int id)
 {
     employeeRepo.Delete(id);
     return(RedirectToAction("ViewEmployee"));
 }
Ejemplo n.º 11
0
 public void DeleteEmployee(int id)
 {
     EmployeeRepo.Delete(id);
 }
Ejemplo n.º 12
0
 // DELETE: api/Employees/5
 public bool Delete(int id)
 {
     return(_repo.Delete(id));
 }