public IActionResult OnPostSave(int id, string email) { if (id > 0) { LinkRepository lRepository = new LinkRepository(connectionString); Link = lRepository.Get(id); Link.Email = email; lRepository.Update(Link); if (!String.IsNullOrEmpty(email)) { EmailServices eServices = new EmailServices(); eServices.SendLink(email, $"{Request.Scheme}://{this.Request.Host}{this.Request.PathBase}/{Link.Url}"); } return(RedirectToPage("Index", new { Id = Link.FileId })); } return(RedirectToPage("/Error")); }