示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            linkRepository.Delete(id);
            linkRepository.Save();

            return(RedirectToAction("Index"));
        }
示例#2
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="termid"></param>
 /// <returns></returns>
 public int Delete(int linkId)
 {
     return(_linkRepository.Delete(new LinkInfo()
     {
         LinkId = linkId
     }));
 }
示例#3
0
        public void Handle(DeleteLinkCommand command)
        {
            var link = _linkRepository.Get(command.LinkId);

            Guard.IsNotNull(link, "link");
            _linkRepository.Delete(link);
        }
示例#4
0
 public IActionResult Delete(int id)
 {
     if (!ModelState.IsValid)
     {
         return(View("Index", id));
     }
     linkRepository.Delete(id);
     return(RedirectToAction("Index", "Link"));
 }
示例#5
0
        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);
            }
        }
示例#7
0
        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));
        }
示例#8
0
        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());
        }
示例#9
0
        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);
        }
示例#10
0
        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));
        }
示例#11
0
 public void Delete(int id)
 {
     _linkRepository.Delete(id);
 }
示例#12
0
 public void DeleteLink(long id)
 {
     linkRepository.Delete(x => x.Id == id);
 }
示例#13
0
        public async Task Delete(Guid id)
        {
            var entity = await _repo.GetById(id);

            await _repo.Delete(entity);
        }
示例#14
0
 public IActionResult Delete([FromRoute] string config, [FromRoute] int id)
 {
     linkRepository.Delete(config, id);
     return(RedirectToAction("Index", "Config", new { config }));
 }
示例#15
0
 /// <summary>
 /// 删除友情链接
 /// </summary>
 /// <param name="link">友情链接实体</param>
 /// <returns></returns>
 public void Delete(LinkEntity link)
 {
     linkRepository.Delete(link);
     categoryService.ClearCategoriesFromItem(link.LinkId, 0, TenantTypeIds.Instance().Link());
 }
示例#16
0
 public IActionResult Delete(Link link)
 {
     repository.Delete(link);
     return(Redirect("Index"));
 }