public void ValidarSala(TbSalaVestibular modelo) { if (modelo.IdSala <= 0) { throw new ArgumentException("Selecione uma sala válida."); } else if (string.IsNullOrEmpty(modelo.DsPeriodo)) { throw new ArgumentException("Preencha o período."); } else if (modelo.NrOrdem <= 0) { throw new ArgumentException("o numero da ordem não pode ser igual a zero."); } else if (modelo.QtInscritos <= 0) { throw new ArgumentException("A quantidade de inscritos não pode ser igual a zero."); } else if (modelo.DsPeriodo == "Selecione" || modelo.DsPeriodo == string.Empty) { throw new ArgumentException("Selecione um período."); } else if (db.VerificarSala(modelo) == true) { throw new ArgumentException("Sala ocupada, escolha algum horário diferente."); } }
public void Alterar(TbSalaVestibular modelo) { if (modelo.IdSalaVestibular == 0) { throw new ArgumentException("Selecione uma sala de vestibular válida."); } ValidarSala(modelo); db.Alterar(modelo); }
public TbSalaVestibular BuscarPorID(int id) { if (id == 0) { throw new ArgumentException("Selecione uma sala de vestibular válida."); } TbSalaVestibular sala = db.BuscarPorID(id); return(sala); }
public SalaVestibularResponse1 CriarResponse(TbSalaVestibular modelo) { SalaVestibularResponse1 response = new SalaVestibularResponse1(); SalaBusiness salaBusiness = new SalaBusiness(); TbSala sala = salaBusiness.BuscarPorID(modelo.IdSala); response.nmSala = sala.NmSala; response.nmLocal = sala.NmLocal; response.idSalaVestibular = modelo.IdSalaVestibular; response.nrOrdem = modelo.NrOrdem; response.qtInscritos = modelo.QtInscritos; response.idSala = modelo.IdSala; response.dsPeriodo = modelo.DsPeriodo; response.idSalaNavigation = modelo.IdSalaNavigation; return(response); }
public bool VerificarSala(TbSalaVestibular modelo) { bool existe = db.TbSalaVestibular.Any(t => t.IdSala == modelo.IdSala && t.DsPeriodo == modelo.DsPeriodo); return(existe); }