public IActionResult Put(int id, Link link) { var currentUser = GetCurrentUserProfile(); link.UserProfileId = currentUser.Id; if (id != link.Id) { return(BadRequest()); } _linkRepository.Update(link); return(NoContent()); }
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")); }
public IActionResult Update([FromBody] JObject body) { string linkId = body.GetValue("linkId").ToString(); string title = body.GetValue("title").ToString(); string linkURL = body.GetValue("linkURL").ToString(); Link link = _linkRepo.GetLink(linkId); if (link != null) { link.Title = title; link.LinkURL = linkURL; return(new JsonResult(_linkRepo.Update(link))); } return(null); }
private async void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e) { tblLink link = e.Row as tblLink; if (link == null) { return; } link.Type = UserManagement.UserSession.Type; if (link.Id > 0) { await rpLink.Update(link); } else { await rpLink.Insert(link); } }
public IActionResult OnPost(Guid id) { if (id != null) { LinkRepository linkRepository = new LinkRepository(connectionString); Link = linkRepository.Get(id); if (Link != null) { FileRepository fileRepository = new FileRepository(connectionString); File = fileRepository.Get(Link.FileId); string filePath = env.WebRootPath + File.Path + @"/" + File.Name; string fileName = File.Name; byte[] fileBytes = System.IO.File.ReadAllBytes(filePath); Link.Count++; linkRepository.Update(Link); return(File(fileBytes, "application/force-download", fileName)); } } return(NotFound()); }
protected void Submit_Click(object sender, EventArgs e) { if (!IsValid) { return; } Link link; if (Submit.CommandName == CMD_UPDATE) { link = LinkRepository.FindById(DataUtility.ParseInt(QsLinkId)); PopulateLinkFromControls(link); LinkRepository.Update(link); } else if (Submit.CommandName == CMD_INSERT) { link = new Link(); PopulateLinkFromControls(link); LinkRepository.Save(link); } Response.Redirect(Cancel.NavigateUrl); }