コード例 #1
0
        public async Task <ViewModel.ServiceResult> PostEditCategory([FromBody] ViewModel.ContentManager.SimpleCategoryManageVM model)
        {
            try
            {
                var res = await ContentManagerRepository.EditCategory(new Models.ContentManager.Category()
                {
                    _id      = model._id,
                    title    = model.title,
                    parentId = model.parentId,
                    userid   = model.userId,
                    blocks   = model.blocks
                });

                if (res)
                {
                    return new ViewModel.ServiceResult()
                           {
                               ServiceResultStatus  = (int)Rdio.Util.Common.ServiceResultStatus.OK,
                               ServiceResultMassage = Util.Common.ServiceResultMessage.OKMessage.ToString()
                           }
                }
                ;
                else
                {
                    return new ViewModel.ServiceResult()
                           {
                               ServiceResultStatus  = (int)Rdio.Util.Common.ServiceResultStatus.Error,
                               ServiceResultMassage = Util.Common.ServiceResultMessage.FaildMessage.ToString()
                           }
                };
            }
            catch (Exception ex)
            {
                return(new ViewModel.ServiceResult()
                {
                    ServiceResultStatus = (int)Rdio.Util.Common.ServiceResultStatus.Error,
                    ServiceResultMassage = ex.GetBaseException().Message
                });
            }
        }