Esempio n. 1
0
        public OperationReturnModel <bool> AddCustomInventoryItems(ListType type, long listId, List <long> customInventoryIds)
        {
            OperationReturnModel <bool> returnValue = new OperationReturnModel <bool>();

            try
            {
                List <long?> newListItems = _listService.AddCustomInventoryItems(this.AuthenticatedUser, this.SelectedUserContext, type, listId, customInventoryIds);

                var list = new ListModel()
                {
                    BranchId       = SelectedUserContext.BranchId,
                    CustomerNumber = SelectedUserContext.CustomerId,
                    Type           = type,
                    ListId         = listId
                };

                _cacheListLogic.RemoveSpecificCachedList(list);

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

                returnValue.SuccessResponse = true;
                returnValue.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                returnValue.IsSuccess    = false;
                returnValue.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("Error adding custom inventory to list", ex);
            }

            return(returnValue);
        }