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

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

            Guard.IsNotNull(link, "link");
            _linkRepository.Delete(link);
        }
Example #4
0
 public IActionResult Delete(int id)
 {
     if (!ModelState.IsValid)
     {
         return(View("Index", id));
     }
     linkRepository.Delete(id);
     return(RedirectToAction("Index", "Link"));
 }
Example #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);
            }
        }
Example #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));
        }
Example #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());
        }
Example #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);
        }
Example #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));
        }
Example #11
0
 public void Delete(int id)
 {
     _linkRepository.Delete(id);
 }
Example #12
0
 public void DeleteLink(long id)
 {
     linkRepository.Delete(x => x.Id == id);
 }
Example #13
0
        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 }));
 }
Example #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());
 }
Example #16
0
 public IActionResult Delete(Link link)
 {
     repository.Delete(link);
     return(Redirect("Index"));
 }