public OperationReturnModel <string> DeleteList(ListType type, long listId)
        {
            OperationReturnModel <string> ret = new OperationReturnModel <string>();

            try
            {
                var list = _listService.ReadList(AuthenticatedUser, SelectedUserContext, type, listId);

                _listService.DeleteList(AuthenticatedUser, SelectedUserContext, type, list);

                _auditLogRepo.WriteToAuditLog(Common.Core.Enumerations.AuditType.ListDelete,
                                              AuthenticatedUser.Name,
                                              String.Format("List {0} ({1}) deleted for customer {2} - {3}",
                                                            list.Name,
                                                            listId,
                                                            this.SelectedUserContext.CustomerId,
                                                            this.SelectedUserContext.BranchId));

                _cacheListLogic.RemoveSpecificCachedList(list);

                _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true));

                ret.SuccessResponse = null;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("DeleteList", ex);
            }
            return(ret);
        }
        public ActionResult DeleteList(ListViewModel list)
        {
            try
            {
                Mapper.Initialize(cfg => cfg.CreateMap <ListViewModel, ListDTO>());
                var listDTO = Mapper.Map <ListViewModel, ListDTO>(list);


                listService.DeleteList(listDTO);

                return(Json("Список контактов удален", JsonRequestBehavior.AllowGet));
            }
            catch (ValidationException ex)
            {
                return(Json("Exception: " + ex.Message + "\nPropery: " + ex.Property, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #3
0
        public IActionResult DeleteList(int id)
        {
            var result = _listService.DeleteList(id);

            if (!result)
            {
                return(BadRequest());
            }

            return(NoContent());
        }
Exemple #4
0
        public async Task <ActionResult <ListResponse> > DeleteList(long id)
        {
            var list = await _ListService.DeleteList(id);

            if (list.Value == null)
            {
                return(NotFound());
            }

            return(Ok(list));
        }
        public IActionResult DeleteList([FromBody] DeleteListDto deleteListDto)
        {
            var userId      = User.GetUserId();
            var deletedList = _listService.DeleteList(deleteListDto, userId);

            if (deletedList == null)
            {
                return(NotFound());
            }
            return(Ok(deletedList.Id));
        }
 public bool DeleteList(ListDTO lists)
 {
     return(_listtService.DeleteList(lists));
 }
        public async Task <IActionResult> Delete(List list)
        {
            await _listService.DeleteList(list.Id);

            return(Ok(list));
        }
Exemple #8
0
 public async Task <IActionResult> Delete(int id)
 {
     listService.DeleteList(id);
     return(NoContent());
 }
 public async Task Handle(DeleteListCommand message, IMessageHandlerContext context)
 {
     await _listService.DeleteList(message.Id, message.UserId);
 }
Exemple #10
0
        public async Task <IActionResult> DeleteList(Guid id)
        {
            await _listService.DeleteList(id);

            return(Ok());
        }