Commit 9f1201b6 by gema

campos obligatorios para que no envien campos vacíos.

parent dc40bd25
......@@ -33,12 +33,23 @@ namespace inutralia.Views.NutriQuestion
var subjectValue = asunto.Text;
var messageValue = consultaEditor.Text;
await ViewModel.SaveData(subjectValue, messageValue);
await DisplayAlert("Exito", "El mensaje se ha enviado correctamente.", "Entendido");
if (subjectValue==null || messageValue==null)
{
await DisplayAlert("Fallo", "El campo asunto y consulta no pueden ir vacíos. Son campos obligatorios.", "Entendido");
(App.Current.MainPage as RootPage).Navigate<HomeView>();
}
else
{
await ViewModel.SaveData(subjectValue, messageValue);
await DisplayAlert("Exito", "El mensaje se ha enviado correctamente.", "Entendido");
(App.Current.MainPage as RootPage).Navigate<HomeView>();
}
}
catch (Exception )
......
......@@ -30,12 +30,19 @@ namespace inutralia.Views.NutriQuestion
try
{
var messageValue = messageEntry.Text;
await ViewModel.saveData(messageValue);
if (messageValue == null)
{
await DisplayAlert("Fallo", "No se puede enviar un mensaje en blanco, campo obligatorio", "Entendido");
await DisplayAlert("Exito", "El mensaje se ha enviado correctamente.", "Entendido");
}
else
{
await ViewModel.saveData(messageValue);
(App.Current.MainPage as RootPage).Navigate<HomeView>();
await DisplayAlert("Exito", "El mensaje se ha enviado correctamente.", "Entendido");
(App.Current.MainPage as RootPage).Navigate<HomeView>();
}
}
catch (Exception)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment