/// <summary> /// Thêm dữ liệu /// </summary> /// <param name="entity"></param> /// <returns>ServiceResult</returns> /// Created by Phạm Việt Thắng (22/02/2021) public virtual ServiceResult Insert(TEntity entity) { ValidateData(entity); if (_serviceResult.Success) { var effectRow = _dbConnector.Change($"Proc_Insert{_className}", entity, System.Data.CommandType.StoredProcedure); if (effectRow == 1) { _serviceResult.Data = 1; _serviceResult.Code = Common.Enum.ResultCode.Created; } else { _serviceResult.Success = false; _serviceResult.Code = Common.Enum.ResultCode.BadRequest; if (_serviceResult.ErrorMessage.UserMessage == String.Empty) { _serviceResult.ErrorMessage.UserMessage += Common.Properties.Resources.Error; } } } return(_serviceResult); }