public OperationResult <Guid?> DeleteProcess(Guid?id) { //Validazione argomenti if (!id.HasValue) { throw new ArgumentNullException(nameof(id)); } //Dichiaro la listsa di risultati di ritorno IList <ValidationResult> vResults = new List <ValidationResult>(); //Definisco l'entità Process entity = _processRepository.Load(id); //Eseguo la validazione logica vResults = ValidateEntity(entity); if (!vResults.Any()) { //Salvataggio su db _processRepository.Delete(entity); } //Ritorno i risultati return(new OperationResult <Guid?> { ReturnedValue = null, ValidationResults = vResults }); }
public void Delete(int id) { var process = _processRepository.GetByIdFullProcess(id); _processRepository.Delete(process); _unitOfWork.Complete(); }
public void Delete(int id) { var process = _processRepository.QueryEager().FirstOrDefault(p => p.Id == id); process.Candidate.Status = SetCandidateStatus(ProcessStatus.Rejected); _processRepository.Delete(process); _unitOfWork.Complete(); }
public async Task <IActionResult> DeleteStep(int userId, string deptName, string objectiveName, string stepNumber) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var stepFromRepo = await _repo.GetStep(userId, deptName, objectiveName, stepNumber); _repo.Delete(stepFromRepo); if (await _repo.SaveAll()) { return(Ok("Step " + stepFromRepo.StepNumber + " was deleted!")); } throw new Exception($"Deleting step {stepNumber}&{deptName} failed on save"); }
public async Task <IActionResult> DeleteCommonDifficulty(int userId, int id) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var commonDifficultyFromRepo = await _repo.GetCommonDifficulty(id); _repo.Delete(commonDifficultyFromRepo); if (await _repo.SaveAll()) { return(Ok("Common difficulty " + commonDifficultyFromRepo.Id + " was deleted!")); } throw new Exception($"Deleting common difficulty {id} failed on save"); }
public async Task <IActionResult> DeleteDepartment(int userId, string deptName) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var departmentFromRepo = await _repo.GetDepartment(userId, deptName); _repo.Delete(departmentFromRepo); if (await _repo.SaveAll()) { return(Ok("Department " + departmentFromRepo.DeptName + " was deleted!")); } throw new Exception($"Deleting department {deptName} failed on save"); }
public async Task <IActionResult> DeleteObjective(int userId, string deptName, string objectiveName) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var objectiveFromRepo = await _repo.GetObjective(userId, deptName, objectiveName); _repo.Delete(objectiveFromRepo); if (await _repo.SaveAll()) { return(Ok("Objective " + objectiveFromRepo.ObjectiveName + " was deleted!")); } throw new Exception($"Deleting objective {objectiveName}&{deptName} failed on save"); }
public async Task <IActionResult> DeleteBestPractice(int userId, int id) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var bestPracticeFromRepo = await _repo.GetBestPractice(id); _repo.Delete(bestPracticeFromRepo); if (await _repo.SaveAll()) { return(Ok("Best practice " + bestPracticeFromRepo.Id + " was deleted!")); } throw new Exception($"Deleting best practice {id} failed on save"); }
public void Delete(Process process) { _processRepository.Delete(process); }