public async Task <IActionResult> RemoveAdvisor(int id) { var currentUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); if (!await _repo.GetUserLevelAdmin(currentUserId)) { return(Unauthorized()); } //if (!await _advisorRepo.AdvisorExists (advisorForCreateDto.FullName)) // ModelState.AddModelError ("Advisor Name", "Advisor Name doesn't exists"); if (!await _advisorRepo.AdvisorIDExists(id)) { ModelState.AddModelError("Advisor Name", "Advisor Name doesn't exists"); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } /* var advisorToDelete = new Advisors { * FullName = advisorForCreateDto.FullName, * FirstName = advisorForCreateDto.FirstName, * LastName = advisorForCreateDto.LastName, * Title = advisorForCreateDto.Title * }; */ // var deleteAdvisor = await _advisorRepo.RemoveAdvisor(advisorToDelete); var deleteAdvisor = await _advisorRepo.RemoveAdvisor(id); return(StatusCode(201)); }
public async Task RemoveAdvisor(AdvisorDTO advisorRemoved) { await _advisorRepository.RemoveAdvisor(advisorRemoved); }
public async Task RemoveAdvisor(string advisorId) { await _advisorRepository.RemoveAdvisor(advisorId); }