Esempio n. 1
0
        public async Task <bool> AddOrUpdateForTodoCenterAsync(TodoCenterBizSystem input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            var dict = await StateManager.GetOrAddAsync <IReliableDictionary2 <string, TodoCenterBizSystem> >(Service.DictionaryName_TodoCenterBizSystem);

            using (var tx = StateManager.CreateTransaction())
            {
                await dict.AddOrUpdateAsync(tx, input.Id, input, (k, v) => input);

                await tx.CommitAsync();

                return(true);
            }
        }
        public async Task <IActionResult> AddOrUpdateTodoCenterBizSystemAsync(TodoCenterBizSystem model)
        {
            try
            {
                if (model == null)
                {
                    throw new ArgumentNullException(nameof(model));
                }
                if (string.IsNullOrEmpty(model.Id))
                {
                    throw new ArgumentOutOfRangeException(nameof(model.Id));
                }

                return(Ok(await _bizSystemAppService.AddOrUpdateForTodoCenterAsync(model)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }