Example #1
0
        /// <summary>
        /// Creates a new support queue.
        /// </summary>
        /// <param name="newDataDto">the dto with the data for the new queue</param>
        /// <returns>the id of the new queue or 0 if failed</returns>
        public static async Task <int> CreateNewSupportQueueAsync(SupportQueueDto newDataDto)
        {
            var newSupportQueue = new SupportQueueEntity();

            newSupportQueue.UpdateFromSupportQueue(newDataDto);
            using (var adapter = new DataAccessAdapter())
            {
                var result = await adapter.SaveEntityAsync(newSupportQueue).ConfigureAwait(false);

                return(result ? newSupportQueue.QueueID : 0);
            }
        }
        public async Task <ActionResult> UpdateSupportQueue([FromBody] SupportQueueDto toUpdate)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var result = await SupportQueueManager.ModifySupportQueueAsync(toUpdate);

            if (result)
            {
                _cache.Remove(CacheKeys.AllSupportQueues);
            }

            // jsGrid requires the updated object as return value.
            return(Json(toUpdate));
        }
        public async Task <ActionResult> InsertSupportQueue([FromBody] SupportQueueDto toInsert)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var queueId = await SupportQueueManager.CreateNewSupportQueueAsync(toInsert);

            if (queueId > 0)
            {
                _cache.Remove(CacheKeys.AllSupportQueues);
                toInsert.QueueID = queueId;
            }

            // jsGrid requires the inserted object as return value.
            return(Json(toInsert));
        }
Example #4
0
        /// <summary>
        /// Modifies the support queue definition data.
        /// </summary>
        /// <param name="toUpdate">the dto containing the data of the support queue to update</param>
        /// <returns>true if succeeded, false otherwise</returns>
        public static async Task <bool> ModifySupportQueueAsync(SupportQueueDto toUpdate)
        {
            if (toUpdate == null)
            {
                return(false);
            }

            var toModify = await SupportQueueGuiHelper.GetSupportQueueAsync(toUpdate.QueueID);

            if (toModify == null)
            {
                // not found
                return(false);
            }

            toModify.UpdateFromSupportQueue(toUpdate);
            using (var adapter = new DataAccessAdapter())
            {
                return(await adapter.SaveEntityAsync(toModify).ConfigureAwait(false));
            }
        }