public ActionResult DeleteConfirmed(int id) { linkRepository.Delete(id); linkRepository.Save(); return(RedirectToAction("Index")); }
/// <summary> /// 删除 /// </summary> /// <param name="termid"></param> /// <returns></returns> public int Delete(int linkId) { return(_linkRepository.Delete(new LinkInfo() { LinkId = linkId })); }
public void Handle(DeleteLinkCommand command) { var link = _linkRepository.Get(command.LinkId); Guard.IsNotNull(link, "link"); _linkRepository.Delete(link); }
public IActionResult Delete(int id) { if (!ModelState.IsValid) { return(View("Index", id)); } linkRepository.Delete(id); return(RedirectToAction("Index", "Link")); }
public async Task <IActionResult> Delete(int linkId) { try { await _linkRepository.Delete(linkId); _toastNotification.AddSuccessToastMessage("Successfully deleted link"); return(RedirectToAction(nameof(Index))); } catch (DbUpdateException) { _toastNotification.AddErrorToastMessage("Error while deleting link"); return(RedirectToAction(nameof(Index))); } }
public async Task <Result> Delete(LinkViewModel model) { try { return(ModelState.IsValid ? await _repository.Delete(LinkViewModel.Get(model)) : Result.Failed); } catch (Exception e) { await _logger.AddException(e); return(Result.Failed); } }
public JsonResult deleteLink(long linkId) { Dictionary <string, object> result = new Dictionary <string, object>(); Console.WriteLine("deleting " + linkId); var linkToBeDeleted = linkRepository.Links.FirstOrDefault(l => l.LinkID == linkId); System.IO.File.Delete(linkToBeDeleted.PathToFile); linkRepository.Delete(linkToBeDeleted); linkRepository.Save(); result.Add("result", true); return(Json(result)); }
public GeneralResponse DeleteLink(Link link) { if (link == null) { throw new ApplicationException("Link was not provided"); } var idResponse = GetByID(link.ID); if (idResponse.Result == null) { throw new ApplicationException("Link with ID " + link.ID + " does not exists!"); } _repo.Delete(link); return(new GeneralResponse()); }
public LinkModel Delete(Guid id) { try { Link link = _mapper.Map <Link>(GetById(id)); if (link != null) { _repo.Delete(link); this.UoW.Commit(); return(_mapper.Map <LinkModel>(link)); } } catch (Exception) { this.UoW.RollBack(); return(null); } return(null); }
public async Task <IHttpActionResult> КickUser([FromUri] string userName, [FromUri] string groupName) { var trueGroup = await _groupRepository.SelectByKey(groupName).ConfigureAwait(false); if (trueGroup.AdminName != _currentUser.UserName) { return(StatusCode(HttpStatusCode.Forbidden)); } var result = await _linkRepository.SelectAllByGroupName(groupName); var linkToDelete = result.Where(x => x.RecieverName == userName); if (linkToDelete.Count() <= 0 || linkToDelete == null) { return(NotFound()); } foreach (Link link in linkToDelete) { await _linkRepository.Delete(link.Id); } return(StatusCode(HttpStatusCode.NoContent)); }
public void Delete(int id) { _linkRepository.Delete(id); }
public void DeleteLink(long id) { linkRepository.Delete(x => x.Id == id); }
public async Task Delete(Guid id) { var entity = await _repo.GetById(id); await _repo.Delete(entity); }
public IActionResult Delete([FromRoute] string config, [FromRoute] int id) { linkRepository.Delete(config, id); return(RedirectToAction("Index", "Config", new { config })); }
/// <summary> /// 删除友情链接 /// </summary> /// <param name="link">友情链接实体</param> /// <returns></returns> public void Delete(LinkEntity link) { linkRepository.Delete(link); categoryService.ClearCategoriesFromItem(link.LinkId, 0, TenantTypeIds.Instance().Link()); }
public IActionResult Delete(Link link) { repository.Delete(link); return(Redirect("Index")); }