public async Task <IActionResult> Share([Bind("SelectedPracticeId, Practices")] SharePlacesViewModel sharePlacesViewModel)
        {
            if (ModelState.IsValid)
            {
                await _placesService.AddSharePlaces(sharePlacesViewModel);

                return(RedirectToAction("Index"));
            }

            return(View(sharePlacesViewModel));
        }
Example #2
0
        public async Task AddSharePlaces(SharePlacesViewModel sharePlacesViewModel)
        {
            var clientPractice = new ClientPractices()
            {
                ClientUserId = _userProvider.GetUserId(), PracticeId = int.Parse(sharePlacesViewModel.SelectedPracticeId)
            };

            _context.ClientPractices.Add(clientPractice);

            await _context.SaveChangesAsync();
        }