예제 #1
0
        private async Task ReportProblem(Bike bike)
        {
            var community = await _communityService.Get(bike.CommunityId);

            var mailAddress = community.SupportEmail;

            try
            {
                var message = new EmailMessage
                {
                    Subject = "Problem mit Fahrrad",
                    Body    = $"Hallo Team von {community.Name},\n" +
                              $"es gibt folgendes Problem mit dem Fahrrad {bike.Name}: \n",
                    To = new List <string> {
                        mailAddress
                    }
                };

                await Email.ComposeAsync(message);
            }
            catch (Exception)
            {
                await _dialogService.ShowError("Versand fehlgeschlagen",
                                               "Es konnte keine Mail-App auf dem Gerät gefunden werden");
            }
        }
예제 #2
0
        public async Task <ActionResult <CommunityResult> > Get(Guid id)
        {
            try
            {
                var result = await _communityService.Get(id);

                return(Ok(result));
            }
            catch (EntityNotFoundException ex)
            {
                _logger.LogWarning(ex, ex.Message);

                return(NotFound("Unable to find Community"));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
            }

            return(BadRequest("Unable to return Community"));
        }