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

            try
            {
                CheckModelState();

                var entity = _templateService.Addinfo(input);

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