public async Task <HttpResponseMessage> ConfirmEmail(Guid tokenGuid) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.RedirectMethod); ItemsResponse <AdminSettings> notify = new ItemsResponse <AdminSettings>(); try { notify.Items = _adminService.SelectByNotifications(); _emailConfirmationService.UpdateById(tokenGuid); string domain = HttpContext.Current.Request.IsLocal ? "http://localhost:1552" : "https://snatched.azurewebsites.net"; foreach (AdminSettings item in notify.Items) { if (item.NewUserEmail == true) { await _sendEmailService.SendEmailNewUser(item.Email); } if (item.NewUserText == true) { string message = "A new user has registered with our amazing app."; _smsService.SendSms(item.PhoneNumber, message); } } response.Headers.Location = new Uri(domain + "/Member/EmailConfirmedPage"); return(response); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }