コード例 #1
0
        public ResponseInfoModel AddInfo([FromBody] CreateCategoryInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var category = _articleCategoryService.Addinfo(input);
                if (category == null)
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.InsertFail;
                }
                else
                {
                    _logService.Insert(new Log()
                    {
                        ActionContent = LocalizationConst.Delete,
                        SourceType    = _moduleName,
                        SourceID      = category.ID,
                        LogUserID     = category.CreateUser,
                        LogTime       = DateTime.Now,
                        LogIPAddress  = IPHelper.GetIPAddress,
                    });
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/addInfo", LocalizationConst.InsertFail);
            }
            return(json);
        }