public bool CanModify(int entityId, PAADViewModel entity) { IPAADRepository PAADRepository = new PAADRepository(); var PAADToModify = PAADRepository.Get(p => p.Id == entityId).FirstOrDefault(); var enRevision = Common.Constants.PAADEstatus_RevisionParaAprobacion; if ((PAADToModify.PAADEstatus_Id != enRevision && PAADIsInRegisterPeriod(entity)) || PAADOwnerIsInDirectorRole(entity)) { return(true); } else { return(false); } }
private bool DocentePAADDoesNotExistAlreadyInCurrentPeriod(PAADViewModel paad) { IPeriodoRepository periodoRepository = new PeriodoRepository(); var period = periodoRepository.ReadPeriodoActual(); IPAADRepository paadRepository = new PAADRepository(); var paadDocenteId = paad.DocenteId; var existingPAAD = paadRepository.ReadPAADs(paadDocenteId, period); if (existingPAAD == null) { return(true); } else { return(false); } }