示例#1
0
        private async void Agregarlesion_Clicked(object sender, EventArgs e)
        {
            //creamos la lesion
            var lesion = new Lesion
            {
                clavedeportista = deportistaa.IDDeportista,
                Lugar           = pickerlugar.SelectedItem.ToString(),
                Tipo            = pickertipo.SelectedItem.ToString(),
                NumLesiones     = int.Parse(numeroLesionesEntry.Text),
            };

            //insertamos el deportista en la base de datos
            using (var datos = new DataAccess())
            {
                datos.InsertLesion(lesion);
                //listaListView.ItemsSource = datos.GetDeportistas();
            }
            //await DisplayAlert("Confirmación", "Lesion agregada", "Aceptar");

            DependencyService.Get <IMessage>().LongAlert("Lesión añadida");
            //new NavigationPage(new Trabajo.Paginas.Inicio());
            // await Navigation.PushAsync(new Trabajo.LesionesView(deportistaa));
            // await Navigation.PopAsync();
            // new NavigationPage(new LesionesView(deportistaa));
            //await Navigation.PushAsync(new LesionesView(deportistaa));

            PopUntilDestination(typeof(LesionesView));
        }
示例#2
0
        public async Task SaveLesionDetails(Lesion lesion, Suggestion suggestion)
        {
            await _dbContext.Lesions.AddAsync(lesion);

            await _dbContext.Suggestions.AddAsync(suggestion);

            await _dbContext.SaveChangesAsync();
        }
示例#3
0
        public async Task <IActionResult> SaveSuggestion([FromBody] LesionViewModel model)
        {
            var    userId = _httpContextAccessor.HttpContext.User.GetLoggedInUserId <string>();
            Lesion lesion = _mapper.Map <Lesion>(model);

            lesion.UserId = Guid.Parse(userId);
            lesion.Id     = Guid.NewGuid();

            Suggestion suggestion = _mapper.Map <Suggestion>(model);

            suggestion.Id       = Guid.NewGuid();
            suggestion.LesionId = lesion.Id;

            await _lesionService.SaveLesionDetails(lesion, suggestion);

            return(Ok());
        }
示例#4
0
        public EditLesion(Lesion lesion)
        {
            InitializeComponent();
            this.lesionn = lesion;

            this.Padding = Device.OnPlatform(
                new Thickness(10, 20, 10, 10),
                new Thickness(10, 10, 10, 10),
                new Thickness(10, 10, 10, 10));

            pickerlugar.Text         = lesion.Lugar;
            pickertipo.Text          = lesion.Tipo;
            numeroLesionesEntry.Text = lesion.NumLesiones.ToString();


            actualizarlesion.Clicked += Actualizarlesion_Clicked;
            borrarlesion.Clicked     += Borrarlesion_Clicked;
        }
示例#5
0
 //eliminar
 public void DeleteLesion(Lesion lesion)
 {
     connection.Delete(lesion);
 }
示例#6
0
 //actualizar
 public void UpdateLesion(Lesion lesion)
 {
     connection.Update(lesion);
 }
示例#7
0
        //ENTRENADOR BASE DE DATOS////////////////

        /*
         * //insertar ENTRENADOR
         * public void InsertEntrenador(Entrenador entrenador)
         * {
         *  connection.Insert(entrenador);
         * }
         * //actualizar
         * public void UpdateEntrenador(Entrenador entrenador)
         * {
         *  connection.Update(entrenador);
         * }
         * //eliminar
         * public void DeleteEntrenador(Entrenador entrenador)
         * {
         *  connection.Delete(entrenador);
         * }
         * //obtener deportista
         * public Entrenador GetEntrenador(int IDEntrenador)
         * {
         *  return connection.Table<Entrenador>().FirstOrDefault(c => c.IDEntrenador == IDEntrenador);
         * }
         * //obtener lista ordenada por apellidos
         * public List<Entrenador> GetEntrenadores()
         * {
         *  return connection.Table<Entrenador>().OrderBy(c => c.Apellidos).ToList();
         * }
         */

        //insertar LESION
        public void InsertLesion(Lesion lesion)
        {
            connection.Insert(lesion);
        }