コード例 #1
0
        /// <inheritdoc />
        /// <summary>
        /// Add new dashboard
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public virtual async Task <ResultModel> CreateDashBoardAsync(DashBoard model)
        {
            var result = new ResultModel();

            if (model == null)
            {
                result.Errors.Add(new ErrorModel(string.Empty, nameof(ArgumentNullException)));
                return(result);
            }

            await _context.Dashboards.AddAsync(model);

            var dbResult = await _context.PushAsync();

            if (!dbResult.IsSuccess)
            {
                return(dbResult);
            }
            if (model.IsActive)
            {
                return(await SetActiveDashBoardAsync(model.Id));
            }

            result.IsSuccess = true;
            return(result);
        }
コード例 #2
0
        /// <inheritdoc />
        /// <summary>
        /// Add new dashboard
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <ResultModel> CreateWidgetGroupAsync(WidgetGroup model)
        {
            var result = new ResultModel();

            if (model == null)
            {
                result.Errors.Add(new ErrorModel(string.Empty, nameof(ArgumentNullException)));
                return(result);
            }

            await _context.WidgetGroups.AddAsync(model);

            var dbResult = await _context.PushAsync();

            if (!dbResult.IsSuccess)
            {
                return(dbResult);
            }
            result.IsSuccess = true;
            return(result);
        }