Beispiel #1
0
        public ResponseInfoModel AddInfo([FromBody] CreateRoleInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();

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